Sha256: b131e084a10f157aee526c6ec8647ee0473b189c1c1a254f5b169e81efa3eb1a
Contents?: true
Size: 630 Bytes
Versions: 22
Compression:
Stored size: 630 Bytes
Contents
module V8 class Object include Enumerable def initialize(native) @native = native end def [](key) @native.context.open do To.ruby(@native.Get(key.to_s)) end end def []=(key, value) value.tap do @native.context.open do @native.Set(key.to_s, value) end end end def each for prop in @native.GetPropertyNames() yield prop, self[prop] end end end end class Object def eval_js(javascript) V8::Context.open(:with => self) do |cxt| cxt.eval(javascript) end end end
Version data entries
22 entries across 22 versions & 1 rubygems
Version | Path |
---|---|
therubyracer-0.4.5 | lib/v8/object.rb |
therubyracer-0.4.4 | lib/v8/object.rb |