1
0
Fork 0
mirror of https://github.com/rubyjs/therubyrhino synced 2023-03-27 23:21:34 -04:00
therubyrhino/lib/rhino/native_object.rb

25 lines
351 B
Ruby
Raw Normal View History

module Rhino
class NativeObject
2009-10-06 10:04:57 -04:00
include Enumerable
attr_reader :j
2009-10-06 10:04:57 -04:00
def initialize(j)
@j = j
end
def [](k)
To.ruby @j.get(k.to_s, @j)
end
def []=(k,v)
@j.put(k.to_s,@j,v)
end
2009-10-06 10:04:57 -04:00
def each
for id in @j.getAllIds() do
yield id,@j.get(id,@j)
end
end
end
end