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.9.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.runtimeObject

Returns the value of attribute runtime.



11
12
13
# File 'lib/execjs/module.rb', line 11

def runtime
  @runtime
end

Class Method Details

.compile(source, options = {}) ⇒ Object



26
27
28
# File 'lib/execjs/module.rb', line 26

def compile(source, options = {})
  runtime.compile(source, options)
end

.cygwin?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/execjs/module.rb', line 38

def cygwin?
  @cygwin ||= RbConfig::CONFIG["host_os"] =~ /cygwin/
end

.eval(source, options = {}) ⇒ Object



22
23
24
# File 'lib/execjs/module.rb', line 22

def eval(source, options = {})
  runtime.eval(source, options)
end

.exec(source, options = {}) ⇒ Object



18
19
20
# File 'lib/execjs/module.rb', line 18

def exec(source, options = {})
  runtime.exec(source, options)
end

.rootObject



30
31
32
# File 'lib/execjs/module.rb', line 30

def root
  @root ||= File.expand_path("..", __FILE__)
end

.runtimesObject



108
109
110
# File 'lib/execjs/runtimes.rb', line 108

def self.runtimes
  Runtimes.runtimes
end

.windows?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/execjs/module.rb', line 34

def windows?
  @windows ||= RbConfig::CONFIG["host_os"] =~ /mswin|mingw/
end