aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/relations/operations/group.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/relations/operations/group.rb')
-rw-r--r--lib/arel/relations/operations/group.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/arel/relations/operations/group.rb b/lib/arel/relations/operations/group.rb
new file mode 100644
index 0000000000..bc3a7f3437
--- /dev/null
+++ b/lib/arel/relations/operations/group.rb
@@ -0,0 +1,19 @@
+module Arel
+ class Group < Compound
+ attr_reader :groupings
+
+ def initialize(relation, *groupings)
+ @relation, @groupings = relation, groupings.collect { |g| g.bind(relation) }
+ end
+
+ def ==(other)
+ Group === other and
+ relation == other.relation and
+ groupings == other.groupings
+ end
+
+ def aggregation?
+ true
+ end
+ end
+end \ No newline at end of file