Class: V8::Portal::FunctionAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/v8/portal/function.rb

Defined Under Namespace

Classes: BindAndCall, Call

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(portal, code) ⇒ FunctionAdapter

Returns a new instance of FunctionAdapter.



7
8
9
10
11
12
# File 'lib/v8/portal/function.rb', line 7

def initialize(portal, code)
  @portal = portal
  @caller = code.respond_to?(:call) ? Call.new(portal) : BindAndCall.new(portal)
  @code = code
  @template = V8::C::FunctionTemplate::New(@caller, @code)
end

Instance Attribute Details

#templateObject (readonly)

Returns the value of attribute template.



5
6
7
# File 'lib/v8/portal/function.rb', line 5

def template
  @template
end

Instance Method Details

#functionObject



14
15
16
# File 'lib/v8/portal/function.rb', line 14

def function
  @template.GetFunction()
end