mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
26 lines
No EOL
402 B
Ruby
26 lines
No EOL
402 B
Ruby
|
|
module V8
|
|
class Object
|
|
include Enumerable
|
|
|
|
def initialize(native)
|
|
@native = native
|
|
end
|
|
|
|
def [](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 |