module ExecJS::Runtimes
Constants
- Disabled
- JScript
- JavaScriptCore
- Johnson
- Mustang
- Node
- RubyRacer
- RubyRhino
- SpiderMonkey
Public Class Methods
autodetect()
click to toggle source
# File lib/execjs/runtimes.rb, line 49 def self.autodetect from_environment || best_available || raise(RuntimeUnavailable, "Could not find a JavaScript runtime. " + "See https://github.com/sstephenson/execjs for a list of available runtimes.") end
best_available()
click to toggle source
# File lib/execjs/runtimes.rb, line 55 def self.best_available runtimes.reject(&:deprecated?).find(&:available?) end
from_environment()
click to toggle source
# File lib/execjs/runtimes.rb, line 59 def self.from_environment if name = ENV["EXECJS_RUNTIME"] if runtime = const_get(name) if runtime.available? runtime if runtime.available? else raise RuntimeUnavailable, "#{runtime.name} runtime is not available on this system" end elsif !name.empty? raise RuntimeUnavailable, "#{name} runtime is not defined" end end end
names()
click to toggle source
# File lib/execjs/runtimes.rb, line 73 def self.names @names ||= constants.inject({}) { |h, name| h.merge(const_get(name) => name) }.values end
runtimes()
click to toggle source
# File lib/execjs/runtimes.rb, line 77 def self.runtimes @runtimes ||= [ RubyRacer, RubyRhino, Johnson, Mustang, Node, JavaScriptCore, SpiderMonkey, JScript ] end