Module: ArelExtensions::BooleanFunctions

Included in:
Nodes::Blank, Nodes::IsNotNull, Nodes::IsNull, Nodes::NotBlank
Defined in:
lib/arel_extensions/boolean_functions.rb

Instance Method Summary collapse

Instance Method Details

#and(*others) ⇒ Object



10
11
12
# File 'lib/arel_extensions/boolean_functions.rb', line 10

def and *others
  Arel::Nodes::And.new([self]+ others.flatten)
end

#or(*others) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/arel_extensions/boolean_functions.rb', line 18

def or *others
  args = others.flatten
  if args.length == 1
    Arel::Nodes::Or.new(self, args.first)
  else
    ArelExtensions::Nodes::Or.new([self]+ args)
  end
end

#then(t, f = nil) ⇒ Object



27
28
29
# File 'lib/arel_extensions/boolean_functions.rb', line 27

def then(t, f = nil)
  ArelExtensions::Nodes::Then.new [self, t, f]
end

#(other) ⇒ Object



6
7
8
# File 'lib/arel_extensions/boolean_functions.rb', line 6

def (other)
  self.and(other)
end

#(other) ⇒ Object



14
15
16
# File 'lib/arel_extensions/boolean_functions.rb', line 14

def (other)
  self.or(other)
end