diff options
Diffstat (limited to 'lib/arel/algebra/relations/operations/group.rb')
-rw-r--r-- | lib/arel/algebra/relations/operations/group.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/arel/algebra/relations/operations/group.rb b/lib/arel/algebra/relations/operations/group.rb new file mode 100644 index 0000000000..04fd9fea62 --- /dev/null +++ b/lib/arel/algebra/relations/operations/group.rb @@ -0,0 +1,15 @@ +module Arel + class Group < Compound + attributes :relation, :groupings + deriving :== + + def initialize(relation, *groupings, &block) + @relation = relation + @groupings = (groupings + (block_given?? [yield(relatoin)] : [])).collect { |g| g.bind(relation) } + end + + def externalizable? + true + end + end +end
\ No newline at end of file |