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