This module includes the boolean/logical AND (&), OR (|) and NOT (~) operators that are defined on objects that can be used in a boolean context in SQL
.
Sequel[:a] & Sequel[:b] # "a" AND "b" Sequel[:a] | Sequel[:b] # "a" OR "b" ~Sequel[:a] # NOT "a"
One exception to this is when a NumericExpression
or Integer is the argument to & or |, in which case a bitwise method will be used:
Sequel[:a] & 1 # "a" & 1 Sequel[:a] | (Sequel[:b] + 1) # "a" | ("b" + 1)
Public Instance methods
~()
Create a new BooleanExpression
with NOT, representing the inversion of whatever self represents.
~Sequel[:a] # NOT :a
[show source]
# File lib/sequel/sql.rb 320 def ~ 321 BooleanExpression.invert(self) 322 end