Class: Arel::Predicates::In
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, #not, #or
Instance Method Details
#complement ⇒ Object
273
274
275
|
# File 'lib/arel/algebra/predicates.rb', line 273
def complement
NotIn.new(operand1, operand2)
end
|
#eval(row) ⇒ Object
277
278
279
|
# File 'lib/arel/algebra/predicates.rb', line 277
def eval(row)
operand2.eval(row).include?(operand1.eval(row))
end
|
#predicate_sql ⇒ Object
291
|
# File 'lib/arel/algebra/predicates.rb', line 291
def predicate_sql; operand2.inclusion_predicate_sql end
|
#to_sql(formatter = nil) ⇒ Object
281
282
283
284
285
286
287
288
289
|
# File 'lib/arel/algebra/predicates.rb', line 281
def to_sql(formatter = nil)
if operand2.is_a?(Range) && operand2.exclude_end?
GreaterThanOrEqualTo.new(operand1, operand2.begin).and(
LessThan.new(operand1, operand2.end)
).to_sql(formatter)
else
super
end
end
|