Class: V8::Portal::FunctionAdapter

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

Defined Under Namespace

Classes: BindAndCall, BoundCall, 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
13
14
15
16
# File 'lib/v8/portal/function.rb', line 7

def initialize(portal, code)
  @portal = portal
  @caller = case code
  when Method then BoundCall.new(portal)
  when UnboundMethod then BindAndCall.new(portal)
  else Call.new(portal)
  end
  @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



18
19
20
# File 'lib/v8/portal/function.rb', line 18

def function
  @template.GetFunction()
end