Module: ExecJS
- Defined in:
- lib/execjs.rb,
lib/execjs/module.rb,
lib/execjs/runtime.rb,
lib/execjs/version.rb,
lib/execjs/runtimes.rb,
lib/execjs/duktape_runtime.rb,
lib/execjs/graaljs_runtime.rb,
lib/execjs/disabled_runtime.rb,
lib/execjs/external_runtime.rb,
lib/execjs/mini_racer_runtime.rb,
lib/execjs/ruby_rhino_runtime.rb
Defined Under Namespace
Modules: Runtimes
Classes: DisabledRuntime, DuktapeRuntime, Error, ExternalRuntime, GraalJSRuntime, MiniRacerRuntime, ProgramError, RubyRhinoRuntime, Runtime, RuntimeError, RuntimeUnavailable
Constant Summary
collapse
- VERSION =
"2.10.1"
Class Method Summary
collapse
Class Method Details
.compile(source, options = {}) ⇒ Object
24
25
26
|
# File 'lib/execjs/module.rb', line 24
def compile(source, options = {})
runtime.compile(source, options)
end
|
.cygwin? ⇒ Boolean
36
37
38
|
# File 'lib/execjs/module.rb', line 36
def cygwin?
@cygwin ||= RbConfig::CONFIG["host_os"] =~ /cygwin/
end
|
.eval(source, options = {}) ⇒ Object
20
21
22
|
# File 'lib/execjs/module.rb', line 20
def eval(source, options = {})
runtime.eval(source, options)
end
|
.exec(source, options = {}) ⇒ Object
16
17
18
|
# File 'lib/execjs/module.rb', line 16
def exec(source, options = {})
runtime.exec(source, options)
end
|
.root ⇒ Object
28
29
30
|
# File 'lib/execjs/module.rb', line 28
def root
@root ||= File.expand_path("..", __FILE__)
end
|
.runtime ⇒ Object
5
6
7
|
# File 'lib/execjs.rb', line 5
def self.runtime
@runtime ||= Runtimes.autodetect
end
|
.runtime=(runtime) ⇒ Object
11
12
13
14
|
# File 'lib/execjs/module.rb', line 11
def runtime=(runtime)
raise RuntimeUnavailable, "#{runtime.name} is unavailable on this system" unless runtime.available?
@runtime = runtime
end
|
.runtimes ⇒ Object
108
109
110
|
# File 'lib/execjs/runtimes.rb', line 108
def self.runtimes
Runtimes.runtimes
end
|
.windows? ⇒ Boolean
32
33
34
|
# File 'lib/execjs/module.rb', line 32
def windows?
@windows ||= RbConfig::CONFIG["host_os"] =~ /mswin|mingw/
end
|