Class: ActiveRecord::Refined::AST::Arithmetic

Inherits:
Node
  • Object
show all
Includes:
Arithmetics, Predications
Defined in:
lib/active_record/refined/ast.rb

Overview

Arithmetic on columns and expressions. Ruby's precedence puts these above the comparison operators, so :price * :quantity > 100 groups the way it reads.

A Duration on the right moves a date: :due_on + 3.days. No two families spell the move alike, so the dialect writes it, a part of the duration at a time.

Instance Method Summary collapse

Methods included from Arithmetics

#&, #*, #+, #-, #/, #<<, #>>, #^, #bitwise_and, #bitwise_not, #bitwise_or, #bitwise_xor, #|, #~

Methods included from Predications

#!=, #!~, #<, #<=, #==, #=~, #>, #>=, #between?, #bury, #casecmp?, #contains?, #dig, #dig_text, #distinct_from?, #end_with?, #except, #false?, #ilike?, #in?, #include?, #intersect?, #key?, #keys, #like?, #member?, #not_between?, #not_distinct_from?, #not_false?, #not_ilike?, #not_in?, #not_like?, #not_null?, #not_true?, #null?, #start_with?, #subset?, #superset?, #true?, #when

Methods inherited from Node

#as, #asc, #collate, #desc

Constructor Details

#initialize(left, operator, right) ⇒ Arithmetic

Returns a new instance of Arithmetic.



1501
1502
1503
1504
1505
# File 'lib/active_record/refined/ast.rb', line 1501

def initialize(left, operator, right)
  @left = left
  @operator = operator
  @right = right
end