blob: 5507ea3163dc8e6b42f96946cec73a7ac8eba78e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
module Arel
class Project < Compound
attributes :relation, :projections
deriving :==
def initialize(relation, *projections, &block)
@relation = relation
@projections = (projections + (block_given?? [yield(relation)] : [])).collect { |p| p.bind(relation) }
end
def attributes
@attributes ||= projections.collect { |p| p.bind(self) }
end
def externalizable?
attributes.any?(&:aggregation?) or relation.externalizable?
end
end
end
|