Class: ExecJS::ExternalRuntime

Inherits:
Object
  • Object
show all
Defined in:
lib/execjs/external_runtime.rb

Defined Under Namespace

Classes: Context

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ExternalRuntime

Returns a new instance of ExternalRuntime.



88
89
90
91
92
93
94
95
# File 'lib/execjs/external_runtime.rb', line 88

def initialize(options)
  @name        = options[:name]
  @command     = options[:command]
  @runner_path = options[:runner_path]
  @test_args   = options[:test_args]
  @test_match  = options[:test_match]
  @binary      = locate_binary
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



86
87
88
# File 'lib/execjs/external_runtime.rb', line 86

def name
  @name
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


111
112
113
114
# File 'lib/execjs/external_runtime.rb', line 111

def available?
  require "multi_json"
  @binary ? true : false
end

#compile(source) ⇒ Object



107
108
109
# File 'lib/execjs/external_runtime.rb', line 107

def compile(source)
  Context.new(self, source)
end

#eval(source) ⇒ Object



102
103
104
105
# File 'lib/execjs/external_runtime.rb', line 102

def eval(source)
  context = Context.new(self)
  context.eval(source)
end

#exec(source) ⇒ Object



97
98
99
100
# File 'lib/execjs/external_runtime.rb', line 97

def exec(source)
  context = Context.new(self)
  context.exec(source)
end