Class: ExecJS::ExternalRuntime

Inherits:
Object
  • Object
show all
Defined in:
lib/bpm/execjs_ext.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ ExternalRuntime

Returns a new instance of ExternalRuntime.



8
9
10
11
12
13
14
15
16
# File 'lib/bpm/execjs_ext.rb', line 8

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

Instance Method Details

#exec_runtime(filename) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/bpm/execjs_ext.rb', line 18

def exec_runtime(filename)
  output = sh("#{@binary} #{filename} 2>&1")
  if $?.success?
    output
  else
    raise RuntimeError, output
  end
end