Class: ExpressionInterpreter::Variable

Inherits:
Object
  • Object
show all
Defined in:
lib/expression_interpreter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (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_sObject



92
93
94
# File 'lib/expression_interpreter.rb', line 92

def to_s
  @name.to_s
end