Class: Romanesco::SubtractionOperator
- Inherits:
-
BinaryOperator
- Object
- Expression
- Operator
- BinaryOperator
- Romanesco::SubtractionOperator
- Defined in:
- lib/romanesco/elements/subtraction_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) ⇒ SubtractionOperator
constructor
A new instance of SubtractionOperator.
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) ⇒ SubtractionOperator
Returns a new instance of SubtractionOperator.
4 5 6 |
# File 'lib/romanesco/elements/subtraction_operator.rb', line 4 def initialize(symbol) @symbol = '-' end |
Instance Method Details
#default_precedence ⇒ Object
13 14 15 |
# File 'lib/romanesco/elements/subtraction_operator.rb', line 13 def default_precedence 10 end |
#evaluate(options) ⇒ Object
8 9 10 11 |
# File 'lib/romanesco/elements/subtraction_operator.rb', line 8 def evaluate() left_result, right_result = super() left_result - right_result end |