Module: ExecJS

Defined in:
lib/execjs.rb,
lib/execjs/runtimes.rb,
lib/execjs/mustang_runtime.rb,
lib/execjs/external_runtime.rb,
lib/execjs/ruby_racer_runtime.rb,
lib/execjs/ruby_rhino_runtime.rb

Defined Under Namespace

Modules: Runtimes Classes: Error, ExternalRuntime, MustangRuntime, ProgramError, RubyRacerRuntime, RubyRhinoRuntime, RuntimeError

Class Method Summary collapse

Class Method Details

.compile(source) ⇒ Object



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

def self.compile(source)
  runtime.compile(source)
end

.eval(source) ⇒ Object



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

def self.eval(source)
  runtime.eval(source)
end

.exec(source) ⇒ Object



14
15
16
# File 'lib/execjs.rb', line 14

def self.exec(source)
  runtime.exec(source)
end

.rootObject



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

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

.runtimeObject



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

def self.runtime
  @runtime ||= Runtimes.best_available ||
    raise(ExecJS::RuntimeError, "Could not find a JavaScript runtime")
end

.runtimesObject



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

def self.runtimes
  Runtimes.runtimes
end

.windows?Boolean

Returns:

  • (Boolean)


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

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