Sha256: 51be79442f7f1afdbd18446a68b23c81bd834321442dbf6965732bfe80da1447

Contents?: true

Size: 652 Bytes

Versions: 5

Compression:

Stored size: 652 Bytes

Contents

module Alf
  module Engine
    class Ungroup < Cog

      # @return [Enumerable] The operand
      attr_reader :operand

      # @return [AttrName] Relation-valued attribute to ungroup
      attr_reader :attribute

      # Creates a Ungroup instance
      def initialize(operand, attribute)
        @operand = operand
        @attribute = attribute
      end

      # (see Cog#each)
      def each
        operand.each do |tuple|
          tuple = tuple.dup
          tuple.delete(@attribute).each do |subtuple|
            yield tuple.merge(subtuple)
          end
        end
      end

    end # class Ungroup
  end # module Engine
end # module Alf

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-0.12.2 lib/alf-engine/alf/engine/ungroup.rb
alf-0.12.1 lib/alf-engine/alf/engine/ungroup.rb
alf-0.12.0 lib/alf-engine/alf/engine/ungroup.rb
alf-0.11.1 lib/alf-engine/alf/engine/ungroup.rb
alf-0.11.0 lib/alf-engine/alf/engine/ungroup.rb