Class: Arel::Predicates::Binary
- Inherits:
-
Predicate
show all
- Defined in:
- lib/arel/algebra/predicates.rb,
lib/arel/engines/sql/predicates.rb,
lib/arel/engines/memory/predicates.rb
Direct Known Subclasses
CompoundPredicate, Equality, GreaterThan, GreaterThanOrEqualTo, In, Inequality, LessThan, LessThanOrEqualTo, Match, NotIn, NotMatch
Instance Method Summary
collapse
Methods inherited from Predicate
#and, #complement, #not, #or
Instance Method Details
#==(other) ⇒ Object
93
94
95
96
97
|
# File 'lib/arel/algebra/predicates.rb', line 93
def ==(other)
self.class === other and
@operand1 == other.operand1 and
@operand2 == other.operand2
end
|
#bind(relation) ⇒ Object
99
100
101
|
# File 'lib/arel/algebra/predicates.rb', line 99
def bind(relation)
self.class.new(operand1.find_correlate_in(relation), operand2.find_correlate_in(relation))
end
|
#eval(row) ⇒ Object
4
5
6
|
# File 'lib/arel/engines/memory/predicates.rb', line 4
def eval(row)
operand1.eval(row).send(operator, operand2.eval(row))
end
|
#to_sql(formatter = nil) ⇒ Object
4
5
6
|
# File 'lib/arel/engines/sql/predicates.rb', line 4
def to_sql(formatter = nil)
"#{operand1.to_sql} #{predicate_sql} #{operand1.format(operand2)}"
end
|