1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00

allow creation of bare V8::Object.

This commit is contained in:
Charles Lowell 2012-06-07 11:47:46 -05:00
parent 11dff1e592
commit 7898e2666a
2 changed files with 4 additions and 4 deletions

View file

@ -69,7 +69,7 @@ end
class Hash class Hash
def to_v8 def to_v8
object = V8::Object.new(V8::C::Object::New()) object = V8::Object.new
each do |key, value| each do |key, value|
object[key] = value object[key] = value
end end

View file

@ -2,9 +2,9 @@ class V8::Object
include Enumerable include Enumerable
attr_reader :native attr_reader :native
def initialize(native) def initialize(native = nil)
@native = native @context = V8::Context.current or fail "tried to initialize a #{self.class} without being in an entered V8::Context"
@context = V8::Context.current @native = native || V8::C::Object::New()
end end
def [](key) def [](key)