Class: RVM::Interpreter::SimpleVariable
- Defined in:
- lib/rvm/optimisation.rb
Overview
Version of the RVM::Interpreter::Variable that handles static variable names
Instance Attribute Summary
Attributes inherited from Element
Instance Method Summary collapse
-
#execute(env) ⇒ Object
The name is a sting and we simple get what is written in the env.
-
#initialize(name, pos = nil) ⇒ SimpleVariable
constructor
A SimpleVariable is initialized wiht 1 to 2 parameters.
- #optimize ⇒ Object
Methods inherited from Variable
Constructor Details
#initialize(name, pos = nil) ⇒ SimpleVariable
A SimpleVariable is initialized wiht 1 to 2 parameters.
- name
-
The name of the variable to get, it will be executed as long as it is no Sybol in which case it is treated as a special variable.
- pos
-
The position within the source code of the definition - for deugging purpose.
49 50 51 |
# File 'lib/rvm/optimisation.rb', line 49 def initialize name, pos = nil super(name.to_s,pos) end |
Instance Method Details
#execute(env) ⇒ Object
The name is a sting and we simple get what is written in the env
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/rvm/optimisation.rb', line 54 def execute env RVM::debug "Executing SimpleVariable at #{@pos}..." if $DEBUG begin r = env.read_var_val(@name) @type = r.data_type if r.respond_to?(:data_type) r rescue Exception => e raise RuntimeError.new("Failed to get Varialbe #{e}", @pos[0], @pos[1], @pos[2]) end end |
#optimize ⇒ Object
65 66 67 |
# File 'lib/rvm/optimisation.rb', line 65 def optimize self end |