aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-07-25 17:39:50 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-07-25 17:39:50 -0700
commit89fb88982fb1a678484cd4bdacae37aa4a599a4a (patch)
tree4ab1314e3712f899882ab28879e2fec0e946be57 /lib
parente4eb64bab3eaa40ce22f0d0c7d008c6eea2988ca (diff)
downloadrails-89fb88982fb1a678484cd4bdacae37aa4a599a4a.tar.gz
rails-89fb88982fb1a678484cd4bdacae37aa4a599a4a.tar.bz2
rails-89fb88982fb1a678484cd4bdacae37aa4a599a4a.zip
unfactoring more metaprogramming
Diffstat (limited to 'lib')
-rw-r--r--lib/arel/algebra/relations/operations/project.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/arel/algebra/relations/operations/project.rb b/lib/arel/algebra/relations/operations/project.rb
index 49d0e1be36..2cdae288e3 100644
--- a/lib/arel/algebra/relations/operations/project.rb
+++ b/lib/arel/algebra/relations/operations/project.rb
@@ -1,10 +1,9 @@
module Arel
class Project < Compound
- attributes :relation, :projections
- deriving :==
+ attr_reader :projections
def initialize(relation, *projections, &block)
- @relation = relation
+ super(relation)
@projections = (projections + arguments_from_block(relation, &block)) \
.collect { |p| p.bind(relation) }
end
@@ -16,5 +15,12 @@ module Arel
def externalizable?
attributes.any? { |a| a.respond_to?(:aggregation?) && a.aggregation? } || relation.externalizable?
end
+
+ def == other
+ super ||
+ Project === other &&
+ relation == other.relation &&
+ projections == other.projections
+ end
end
end