blob: 5f1726d3810ec06e6d39bd7836c384fec064cb8b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
module ActiveRelation
class Selection < Compound
attr_reader :predicate
def initialize(relation, *predicates)
@predicate = predicates.shift
@relation = predicates.empty?? relation : Selection.new(relation, *predicates)
end
def ==(other)
self.class == other.class and relation == other.relation and predicate == other.predicate
end
def qualify
Selection.new(relation.qualify, predicate.qualify)
end
protected
def selects
relation.send(:selects) + [predicate]
end
end
end
|