Map (binary) logic operators to AND and OR

This commit is contained in:
Loic Nageleisen 2017-11-21 13:58:29 +01:00
parent 9c4c031db9
commit 000e7f2ae2
2 changed files with 13 additions and 0 deletions

View file

@ -105,10 +105,12 @@ module Rebel::SQL
def and(*clause)
Raw.new("#{self.parens?} AND #{Rebel::SQL.and_clause(*clause)}")
end
alias & and
def or(*clause)
Raw.new("#{self} OR #{Rebel::SQL.and_clause(*clause)}").wants_parens!
end
alias | or
def eq(n)
case n