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.



60
61
62
63
64
65
66
67
68
# File 'lib/execjs/external_runtime.rb', line 60

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



58
59
60
# File 'lib/execjs/external_runtime.rb', line 58

def name
  @name
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


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

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

#compile(source) ⇒ Object



80
81
82
# File 'lib/execjs/external_runtime.rb', line 80

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

#eval(source) ⇒ Object



75
76
77
78
# File 'lib/execjs/external_runtime.rb', line 75

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

#exec(source) ⇒ Object



70
71
72
73
# File 'lib/execjs/external_runtime.rb', line 70

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