aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-07-20 17:37:03 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-07-20 17:37:03 -0700
commit6da9e6d6818b3f33b73e929ea57c40ea8d2f1829 (patch)
treebdcc1318b7f9051476b7c2061fed5acac86acb5a
parent56f2de870a7279e11575f6d0c6f2f9eea1374407 (diff)
downloadrails-6da9e6d6818b3f33b73e929ea57c40ea8d2f1829.tar.gz
rails-6da9e6d6818b3f33b73e929ea57c40ea8d2f1829.tar.bz2
rails-6da9e6d6818b3f33b73e929ea57c40ea8d2f1829.zip
unfactoring more meta programming
-rw-r--r--lib/arel/algebra/relations/operations/group.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/arel/algebra/relations/operations/group.rb b/lib/arel/algebra/relations/operations/group.rb
index 2bfc42214b..68c626e917 100644
--- a/lib/arel/algebra/relations/operations/group.rb
+++ b/lib/arel/algebra/relations/operations/group.rb
@@ -1,12 +1,18 @@
module Arel
class Group < Compound
- attributes :relation, :groupings
- deriving :==
+ attr_reader :groupings
def initialize(relation, *groupings, &block)
- @relation = relation
+ super(relation)
@groupings = (groupings + arguments_from_block(relation, &block)) \
.collect { |g| g.bind(relation) }
end
+
+ def == other
+ super ||
+ self.class === other &&
+ @relation == other.relation &&
+ @groupings == other.groupings
+ end
end
end