Class: RVM::Interpreter::ObjectContext
- Inherits:
-
Object
- Object
- RVM::Interpreter::ObjectContext
- Defined in:
- lib/rvm/interpreter.rb
Overview
Skipps into object context (anther way beside using send)
the special variable :self (attention, not to be mixed wiht ‘self’) is set to the object in which context we are!
The class is stred in :class
Instance Method Summary collapse
- #execute(env) ⇒ Object
-
#initialize(object, code, pos = nil) ⇒ ObjectContext
constructor
A new instance of ObjectContext.
Constructor Details
#initialize(object, code, pos = nil) ⇒ ObjectContext
Returns a new instance of ObjectContext.
186 187 188 189 190 |
# File 'lib/rvm/interpreter.rb', line 186 def initialize object, code, pos = nil @object = object @code = code @pos = pos end |
Instance Method Details
#execute(env) ⇒ Object
192 193 194 195 196 197 198 |
# File 'lib/rvm/interpreter.rb', line 192 def execute env #The new obj = @object.execute(env) new_env = Interpreter::Enviroment.new({:functions => obj.functions, :locals => obj.variables}, env) new_env.define(:self, obj) @code.execute(new_env) end |