Class: ExpressionInterpreter::Variable
- Inherits:
-
Object
- Object
- ExpressionInterpreter::Variable
- Defined in:
- lib/expression_interpreter.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #evaluate(conext) ⇒ Object
-
#initialize(name) ⇒ Variable
constructor
A new instance of Variable.
- #to_s ⇒ Object
Constructor Details
#initialize(name) ⇒ Variable
Returns a new instance of Variable.
86 87 88 |
# File 'lib/expression_interpreter.rb', line 86 def initialize(name) @name = name.to_sym end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
85 86 87 |
# File 'lib/expression_interpreter.rb', line 85 def name @name end |
Instance Method Details
#evaluate(conext) ⇒ Object
89 90 91 |
# File 'lib/expression_interpreter.rb', line 89 def evaluate(conext) conext.look_up(@name) end |
#to_s ⇒ Object
92 93 94 |
# File 'lib/expression_interpreter.rb', line 92 def to_s @name.to_s end |