Class: Nydp::Closure

Inherits:
Object
  • Object
show all
Defined in:
lib/nydp/closure.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ifn, context) ⇒ Closure

Returns a new instance of Closure.



5
6
7
# File 'lib/nydp/closure.rb', line 5

def initialize ifn, context
  @ifn, @context = ifn, context
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



3
4
5
# File 'lib/nydp/closure.rb', line 3

def context
  @context
end

#ifnObject

Returns the value of attribute ifn.



3
4
5
# File 'lib/nydp/closure.rb', line 3

def ifn
  @ifn
end

Instance Method Details

#invoke(vm, arg_values) ⇒ Object



9
10
11
# File 'lib/nydp/closure.rb', line 9

def invoke vm, arg_values
  ifn.invoke vm, context, arg_values
end

#to_sObject



13
14
15
# File 'lib/nydp/closure.rb', line 13

def to_s
  "(closure #{context.inspect} : #{ifn.to_s})"
end