Class: RVM::Interpreter::SetClassFunction
- Defined in:
- lib/rvm/interpreter.rb
Overview
This sets a funciton on a Class (to be included in its objects)
To define class functions use ObjectContext and define the function normaly, nifty isn’t it?
Instance Attribute Summary
Attributes inherited from Element
Instance Method Summary collapse
- #execute(env) ⇒ Object
-
#initialize(obj, name, function, pos = nil) ⇒ SetClassFunction
constructor
A new instance of SetClassFunction.
Constructor Details
#initialize(obj, name, function, pos = nil) ⇒ SetClassFunction
Returns a new instance of SetClassFunction.
216 217 218 219 220 221 |
# File 'lib/rvm/interpreter.rb', line 216 def initialize obj, name, function, pos = nil super(pos) @object = obj @name = name @function = function end |
Instance Method Details
#execute(env) ⇒ Object
223 224 225 226 |
# File 'lib/rvm/interpreter.rb', line 223 def execute env @object.object_functions[@name.execute(env)] = @function @function end |