mirror of
https://github.com/rubyjs/therubyrhino
synced 2023-03-27 23:21:34 -04:00
14 lines
328 B
Ruby
14 lines
328 B
Ruby
|
|
||
|
module Rhino
|
||
|
class NativeFunction < NativeObject
|
||
|
def call(*args)
|
||
|
begin
|
||
|
cxt = J::Context.enter()
|
||
|
scope = @j.getParentScope() || cxt.initStandardObjects()
|
||
|
@j.call(cxt, scope, scope, args.map {|o| To.javascript(o)})
|
||
|
ensure
|
||
|
J::Context.exit()
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|