Module: ActiveRecord::Refined::AST::Arithmetics
- Included in:
- Aggregate, Arithmetic, Bitwise, BitwiseNot, Case, Cast, Column, DatetimeValueFunction, Extract, Function, JsonPath, Over, Value
- Defined in:
- lib/active_record/refined/ast.rb
Overview
Arithmetic builders shared by symbols, qualified columns and expressions. Imported into the Symbol refinement like Predications, so every method must be defined with def.
Instance Method Summary collapse
-
#&(other) ⇒ Object
SQL's bitwise operators.
- #*(other) ⇒ Object
- #+(other) ⇒ Object
- #-(other) ⇒ Object
- #/(other) ⇒ Object
- #<<(other) ⇒ Object
- #>>(other) ⇒ Object
- #^(other) ⇒ Object
- #|(other) ⇒ Object
- #~ ⇒ Object
Instance Method Details
#&(other) ⇒ Object
SQL's bitwise operators. & and | are AND and OR between conditions
and are defined there, which is what leaves them free to mean here
what SQL means by them. Ruby's precedence puts all six above the
comparisons, so :flags & 4 > 0 groups the way it reads.
284 285 286 |
# File 'lib/active_record/refined/ast.rb', line 284 def &(other) Bitwise.new(self, :&, other) end |
#*(other) ⇒ Object
272 273 274 |
# File 'lib/active_record/refined/ast.rb', line 272 def *(other) Arithmetic.new(self, :*, other) end |
#+(other) ⇒ Object
264 265 266 |
# File 'lib/active_record/refined/ast.rb', line 264 def +(other) Arithmetic.new(self, :+, other) end |
#-(other) ⇒ Object
268 269 270 |
# File 'lib/active_record/refined/ast.rb', line 268 def -(other) Arithmetic.new(self, :-, other) end |
#/(other) ⇒ Object
276 277 278 |
# File 'lib/active_record/refined/ast.rb', line 276 def /(other) Arithmetic.new(self, :/, other) end |
#<<(other) ⇒ Object
296 297 298 |
# File 'lib/active_record/refined/ast.rb', line 296 def <<(other) Bitwise.new(self, :<<, other) end |
#>>(other) ⇒ Object
300 301 302 |
# File 'lib/active_record/refined/ast.rb', line 300 def >>(other) Bitwise.new(self, :>>, other) end |
#^(other) ⇒ Object
292 293 294 |
# File 'lib/active_record/refined/ast.rb', line 292 def ^(other) Bitwise.new(self, :^, other) end |
#|(other) ⇒ Object
288 289 290 |
# File 'lib/active_record/refined/ast.rb', line 288 def |(other) Bitwise.new(self, :|, other) end |
#~ ⇒ Object
304 305 306 |
# File 'lib/active_record/refined/ast.rb', line 304 def ~ BitwiseNot.new(self) end |