Class: Arel::Predicates::CompoundPredicate

Inherits:
Binary show all
Defined in:
lib/arel/algebra/predicates.rb

Direct Known Subclasses

And, Or

Instance Attribute Summary

Attributes inherited from Binary

#operand2

Attributes inherited from Unary

#operand

Instance Method Summary collapse

Methods inherited from Binary

#==, #bind, #initialize

Methods inherited from Unary

#==, #bind, #initialize

Methods inherited from Predicate

#and, #complement, #not, #or

Constructor Details

This class inherits a constructor from Arel::Predicates::Binary

Instance Method Details

#eval(row) ⇒ Object



148
149
150
# File 'lib/arel/algebra/predicates.rb', line 148

def eval(row)
  eval "operand1.eval(row) #{operator} operand2.eval(row)"
end

#to_sql(formatter = nil) ⇒ Object



152
153
154
# File 'lib/arel/algebra/predicates.rb', line 152

def to_sql(formatter = nil)
  "(#{operand1.to_sql(formatter)} #{predicate_sql} #{operand2.to_sql(formatter)})"
end