lib/v8/object.rb in therubyracer-0.4.2 vs lib/v8/object.rb in therubyracer-0.4.3

- old
+ new

@@ -1,12 +1,26 @@ module V8 class Object + include Enumerable + def initialize(native) @native = native end def [](key) - To.ruby(@native.Get(key)) + To.ruby(@native.Get(key.to_s)) + end + + def []=(key, value) + value.tap do + @native.Set(key.to_s, value) + end + end + + def each + for prop in @native.GetPropertyNames() + yield prop, self[prop] + end end end end \ No newline at end of file