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

bind global scope object to potential ruby implementation *after* creating the context, that way, context.scope is *always* a V8::Object

This commit is contained in:
Charles Lowell 2010-08-05 11:35:30 -05:00
parent 4a4bd1beeb
commit bec7b7a13d

View file

@ -6,8 +6,8 @@ module V8
def initialize(opts = {})
@native = opts[:with] ? C::Context::New(Access.rubyobject) : C::Context::New()
@native.enter do
@native.Global().SetHiddenValue(C::String::New("TheRubyRacer::RubyObject"), C::External::New(opts[:with])) if opts[:with]
@scope = To.rb(@native.Global())
@native.Global().SetHiddenValue(C::String::New("TheRubyRacer::RubyObject"), C::External::New(opts[:with])) if opts[:with]
end
yield(self) if block_given?
end