Class: Nudge::ReferencePoint
- Inherits:
-
ProgramPoint
- Object
- ProgramPoint
- Nudge::ReferencePoint
- Defined in:
- lib/interpreter/programPoints.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
(also: #value)
Returns the value of attribute name.
Instance Method Summary collapse
- #blueprint ⇒ Object
- #blueprint_parts ⇒ Object
- #go(context) ⇒ Object
-
#initialize(var_name) ⇒ ReferencePoint
constructor
A new instance of ReferencePoint.
- #points ⇒ Object
- #randomize(context) ⇒ Object
- #tidy(level = 1) ⇒ Object
Methods inherited from ProgramPoint
Constructor Details
#initialize(var_name) ⇒ ReferencePoint
Returns a new instance of ReferencePoint.
164 165 166 |
# File 'lib/interpreter/programPoints.rb', line 164 def initialize(var_name) @name = var_name end |
Instance Attribute Details
#name ⇒ Object Also known as: value
Returns the value of attribute name.
161 162 163 |
# File 'lib/interpreter/programPoints.rb', line 161 def name @name end |
Instance Method Details
#blueprint ⇒ Object
195 196 197 |
# File 'lib/interpreter/programPoints.rb', line 195 def blueprint return self.tidy end |
#blueprint_parts ⇒ Object
191 192 193 |
# File 'lib/interpreter/programPoints.rb', line 191 def blueprint_parts [self.tidy,""] end |
#go(context) ⇒ Object
168 169 170 171 172 173 174 175 176 |
# File 'lib/interpreter/programPoints.rb', line 168 def go(context) lookedUp = context.lookup(@name) if context.evaluate_references if lookedUp context.stacks[:exec].push(lookedUp) else context.stacks[:name].push(self) context.evaluate_references = true end end |
#points ⇒ Object
178 179 180 |
# File 'lib/interpreter/programPoints.rb', line 178 def points 1 end |
#randomize(context) ⇒ Object
186 187 188 189 |
# File 'lib/interpreter/programPoints.rb', line 186 def randomize(context) which = context.references.sample @name = which end |
#tidy(level = 1) ⇒ Object
182 183 184 |
# File 'lib/interpreter/programPoints.rb', line 182 def tidy(level=1) "ref " + @name end |