Class: Romanesco::AdditionOperator
- Inherits:
-
BinaryOperator
- Object
- Expression
- Operator
- BinaryOperator
- Romanesco::AdditionOperator
- Defined in:
- lib/romanesco/elements/addition_operator.rb
Instance Attribute Summary
Attributes inherited from BinaryOperator
#left_operand, #right_operand, #symbol
Attributes inherited from Operator
Attributes inherited from Expression
Instance Method Summary collapse
- #default_precedence ⇒ Object
- #evaluate(options = {}) ⇒ Object
-
#initialize(symbol) ⇒ AdditionOperator
constructor
A new instance of AdditionOperator.
Methods inherited from BinaryOperator
#insert_element_to_left, #insert_element_to_right, #to_s
Methods inherited from Operator
#check_for_blank_symbol, #connect, #connect_in_place, #connect_in_place_with_parent, #connect_to_left, #connect_to_right, #connect_up_tree, #precedence, #precedence=
Constructor Details
#initialize(symbol) ⇒ AdditionOperator
Returns a new instance of AdditionOperator.
6 7 8 |
# File 'lib/romanesco/elements/addition_operator.rb', line 6 def initialize(symbol) @symbol = '+' end |
Instance Method Details
#default_precedence ⇒ Object
15 16 17 |
# File 'lib/romanesco/elements/addition_operator.rb', line 15 def default_precedence 10 end |
#evaluate(options = {}) ⇒ Object
10 11 12 13 |
# File 'lib/romanesco/elements/addition_operator.rb', line 10 def evaluate(={}) left_result, right_result = super() left_result + right_result end |