Class: CompareNode
Overview
Operation Nodes
Instance Attribute Summary collapse
-
#lhs ⇒ Object
Returns the value of attribute lhs.
-
#op ⇒ Object
Returns the value of attribute op.
-
#rhs ⇒ Object
Returns the value of attribute rhs.
Attributes inherited from Node
Instance Method Summary collapse
- #evaluate ⇒ Object
-
#initialize(lhs, op, rhs) ⇒ CompareNode
constructor
A new instance of CompareNode.
- #to_s ⇒ Object
Constructor Details
#initialize(lhs, op, rhs) ⇒ CompareNode
Returns a new instance of CompareNode.
146 147 148 |
# File 'lib/nodes/basenodes.rb', line 146 def initialize(lhs, op, rhs) @lhs, @op, @rhs = lhs, op, rhs end |
Instance Attribute Details
#lhs ⇒ Object
Returns the value of attribute lhs.
144 145 146 |
# File 'lib/nodes/basenodes.rb', line 144 def lhs @lhs end |
#op ⇒ Object
Returns the value of attribute op.
144 145 146 |
# File 'lib/nodes/basenodes.rb', line 144 def op @op end |
#rhs ⇒ Object
Returns the value of attribute rhs.
144 145 146 |
# File 'lib/nodes/basenodes.rb', line 144 def rhs @rhs end |
Instance Method Details
#evaluate ⇒ Object
154 155 156 |
# File 'lib/nodes/basenodes.rb', line 154 def evaluate @value = @lhs.evaluate.send(@op, @rhs.evaluate) end |
#to_s ⇒ Object
150 151 152 |
# File 'lib/nodes/basenodes.rb', line 150 def to_s "#{@lhs} #{@op} #{@rhs}" end |