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.
276 277 278 |
# File 'lib/active_record/refined/ast.rb', line 276 def &(other) Bitwise.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
256 257 258 |
# File 'lib/active_record/refined/ast.rb', line 256 def +(other) Arithmetic.new(self, :+, other) end |
#-(other) ⇒ Object
260 261 262 |
# File 'lib/active_record/refined/ast.rb', line 260 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
288 289 290 |
# File 'lib/active_record/refined/ast.rb', line 288 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
284 285 286 |
# File 'lib/active_record/refined/ast.rb', line 284 def ^(other) Bitwise.new(self, :^, other) end |
#|(other) ⇒ Object
280 281 282 |
# File 'lib/active_record/refined/ast.rb', line 280 def |(other) Bitwise.new(self, :|, other) end |
#~ ⇒ Object
296 297 298 |
# File 'lib/active_record/refined/ast.rb', line 296 def ~ BitwiseNot.new(self) end |