blob: 3e5b9ce1930fc1882167654dd2823d84bca7064a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
class BinaryPredicate < Predicate
attr_reader :attribute1, :attribute2
def initialize(attribute1, attribute2)
@attribute1, @attribute2 = attribute1, attribute2
end
def ==(other)
super and
(attribute1.eql?(other.attribute1) and attribute2.eql?(other.attribute2))
end
def to_sql(builder = ConditionsBuilder.new)
builder.call do
send(predicate_name, attribute1.to_sql(self), attribute2.to_sql(self))
end
end
end
|