Class: Romanesco::DivisionOperator

Inherits:
BinaryOperator show all
Defined in:
lib/romanesco/elements/division_operator.rb

Instance Attribute Summary

Attributes inherited from BinaryOperator

#left_operand, #right_operand, #symbol

Attributes inherited from Operator

#symbol

Attributes inherited from Expression

#parent

Instance Method Summary collapse

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_precedenceObject



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(options)
  left_result, right_result = super(options)
  left_result / right_result
end