Class: CapriccIo::Method
- Defined in:
- lib/capriccio/runtime/method.rb
Instance Attribute Summary
Attributes inherited from CObject
Instance Method Summary collapse
- #call(receiver, calling_context, *args) ⇒ Object
-
#initialize(context, message) ⇒ Method
constructor
A new instance of Method.
Methods inherited from CObject
#[], #[]=, #clone, #def, #to_s
Constructor Details
Instance Method Details
#call(receiver, calling_context, *args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/capriccio/runtime/method.rb', line 11 def call(receiver, calling_context, *args) method_context = @definition_context.clone method_context['self'] = receiver method_context['arguments'] = Runtime['List'].clone(args) method_context['eval_arg'] = proc do |_receiver, context, at| (args[at.call(context).value] || Runtime['nil']).call(calling_context) end @message.call(method_context) end |