mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
27 lines
No EOL
445 B
Ruby
27 lines
No EOL
445 B
Ruby
|
|
module V8::ExtSpec
|
|
|
|
def self.included(object)
|
|
object.class_eval do
|
|
before do
|
|
@lock = c::Locker.new
|
|
@cxt = c::Context::New()
|
|
@cxt.Enter()
|
|
end
|
|
after do
|
|
@cxt.Exit()
|
|
@cxt.Dispose()
|
|
@lock.delete
|
|
end
|
|
end
|
|
end
|
|
|
|
def v8_eval(script, sourcename = "<eval>")
|
|
c::Script::New(c::String::New(script), c::String::New(sourcename)).Run()
|
|
end
|
|
|
|
def c
|
|
V8::C
|
|
end
|
|
|
|
end |