mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
25 lines
522 B
Ruby
25 lines
522 B
Ruby
|
class V8::Function < V8::Object
|
||
|
def initialize(native = nil)
|
||
|
super do
|
||
|
native || V8::C::Function::New()
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def methodcall(this, *args)
|
||
|
@context.enter do
|
||
|
@context.to_ruby native.Call(@context.to_v8(this), args.map {|a| @context.to_v8 a})
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def call(*args)
|
||
|
@context.enter do
|
||
|
methodcall @context.native.Global(), *args
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def new(*args)
|
||
|
@context.enter do
|
||
|
@context.to_ruby native.NewInstance(args.map {|a| @context.to_v8 a})
|
||
|
end
|
||
|
end
|
||
|
end
|