Class: ExpressionInterpreter::Constant

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

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Constant

Returns a new instance of Constant.



98
99
100
# File 'lib/expression_interpreter.rb', line 98

def initialize(value)
  @value = value.to_f
end

Instance Method Details

#evaluate(context) ⇒ Object



101
102
103
# File 'lib/expression_interpreter.rb', line 101

def evaluate(context)
  @value
end

#to_sObject



104
105
106
# File 'lib/expression_interpreter.rb', line 104

def to_s
  @value.to_s
end