Class: Rhino::RubyFunction

Inherits:
J::BaseFunction
  • Object
show all
Defined in:
lib/rhino/ruby_function.rb

Instance Method Summary collapse

Constructor Details

#initialize(callable) ⇒ RubyFunction

Returns a new instance of RubyFunction.



5
6
7
8
# File 'lib/rhino/ruby_function.rb', line 5

def initialize(callable)
  super()
  @callable = callable
end

Instance Method Details

#call(cxt, scope, this, args) ⇒ Object



10
11
12
# File 'lib/rhino/ruby_function.rb', line 10

def call(cxt, scope, this, args)
  To.javascript @callable.call(*args.map {|a| To.ruby(a)})
end