# File lib/execjs/ruby_racer_runtime.rb, line 41 def call(properties, *args) lock do begin unbox @v8_context.eval(properties).call(*args) rescue ::V8::JSError => e if e.value["name"] == "SyntaxError" raise RuntimeError, e.value.to_s else raise ProgramError, e.value.to_s end end end end
# File lib/execjs/ruby_racer_runtime.rb, line 23 def eval(source, options = {}) source = encode(source) if /\S/ =~ source lock do begin unbox @v8_context.eval("(#{source})") rescue ::V8::JSError => e if e.value["name"] == "SyntaxError" raise RuntimeError, e.value.to_s else raise ProgramError, e.value.to_s end end end end end
# File lib/execjs/ruby_racer_runtime.rb, line 15 def exec(source, options = {}) source = encode(source) if /\S/ =~ source eval "(function(){#{source}})()", options end end
# File lib/execjs/ruby_racer_runtime.rb, line 55 def unbox(value) case value when ::V8::Function nil when ::V8::Array value.map { |v| unbox(v) } when ::V8::Object value.inject({}) do |vs, (k, v)| vs[k] = unbox(v) unless v.is_a?(::V8::Function) vs end when String value.respond_to?(:force_encoding) ? value.force_encoding('UTF-8') : value else value end end
Generated with the Darkfish Rdoc Generator 2.