blob: a1140e91c184ef441241cbbb98a00208dd4f8196 (
plain) (
tree)
|
|
module Arel
class Project < Compound
attributes :relation, :projections
deriving :==
def initialize(relation, *projections, &block)
@relation = relation
@projections = (projections + arguments_from_block(relation, &block)) \
.collect { |p| p.bind(relation) }
end
def attributes
@attributes ||= projections.collect { |p| p.bind(self) }
end
def externalizable?
attributes.any? { |a| a.respond_to?(:aggregation?) && a.aggregation? } || relation.externalizable?
end
end
end
|