Method: ExecJS::RubyRacerRuntime::Context#unbox

Defined in:
lib/execjs/ruby_racer_runtime.rb

#unbox(value) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# 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.force_encoding('UTF-8')
  else
    value
  end
end