Class: V8::Conversion::Code::InvocationHandler

Inherits:
Object
  • Object
show all
Includes:
Error::Protect
Defined in:
lib/v8/conversion/code.rb

Instance Method Summary collapse

Methods included from Error::Protect

#protect

Constructor Details

#initialize(code) ⇒ InvocationHandler

Returns a new instance of InvocationHandler.



18
19
20
# File 'lib/v8/conversion/code.rb', line 18

def initialize(code)
  @code = code
end

Instance Method Details

#call(arguments) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/v8/conversion/code.rb', line 22

def call(arguments)
  protect do
    context = V8::Context.current
    access = context.access
    args = ::Array.new(arguments.Length())
    0.upto(args.length - 1) do |i|
      if i < args.length
        args[i] = context.to_ruby arguments[i]
      end
    end
    this = context.to_ruby arguments.This()
    context.to_v8 access.methodcall(@code, this, args)
  end
end