Runtime
# File lib/execjs/external_runtime.rb, line 91 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] @deprecated = !!options[:deprecated] @binary = nil end
# File lib/execjs/external_runtime.rb, line 137 def exec_runtime(filename) output = sh("#{shell_escape(*(binary.split(' ') << filename))} 2>&1") if $?.success? output else raise RuntimeError, output end end
# File lib/execjs/external_runtime.rb, line 146 def locate_binary if binary = which(@command) if @test_args output = `#{shell_escape(binary, @test_args)} 2>&1` binary if output.match(@test_match) else binary end end end
# File lib/execjs/external_runtime.rb, line 133 def runner_source @runner_source ||= IO.read(@runner_path) end
# File lib/execjs/external_runtime.rb, line 169 def sh(command) output, options = nil, {} options[:external_encoding] = @encoding if @encoding options[:internal_encoding] = ::Encoding.default_internal || 'UTF-8' IO.popen(command, options) { |f| output = f.read } output end
Generated with the Darkfish Rdoc Generator 2.