# File lib/execjs/ruby_rhino_runtime.rb, line 36 def call(properties, *args) unbox @rhino_context.eval(properties).call(*args) rescue ::Rhino::JSError => e if e.message == "syntax error" raise RuntimeError, e.message else raise ProgramError, e.message end end
# File lib/execjs/ruby_rhino_runtime.rb, line 22 def eval(source, options = {}) source = encode(source) if /\S/ =~ source unbox @rhino_context.eval("(#{source})") end rescue ::Rhino::JSError => e if e.message =~ /^syntax error/ raise RuntimeError, e.message else raise ProgramError, e.message end end
# File lib/execjs/ruby_rhino_runtime.rb, line 14 def exec(source, options = {}) source = encode(source) if /\S/ =~ source eval "(function(){#{source}})()", options end end
# File lib/execjs/ruby_rhino_runtime.rb, line 46 def unbox(value) case value = ::Rhino::to_ruby(value) when Java::OrgMozillaJavascript::NativeFunction nil when Java::OrgMozillaJavascript::NativeObject value.inject({}) do |vs, (k, v)| case v when Java::OrgMozillaJavascript::NativeFunction, ::Rhino::JS::Function nil else vs[k] = unbox(v) end vs end when Array value.map { |v| unbox(v) } else value end end
Generated with the Darkfish Rdoc Generator 2.