Sha256: f07f870d4c2d5346c6689b6a3e391ee2b3954d01501f0cd4d342039f7d0e1307

Contents?: true

Size: 864 Bytes

Versions: 5

Compression:

Stored size: 864 Bytes

Contents

module Alf
  module Engine
    class Summarize::Hash < Cog

      # @return [Enumerable] The operand
      attr_reader :operand

      # @return [AttrList] Summarization key
      attr_reader :by

      # @return [Summarization] The summarization to use
      attr_reader :summarization

      # @return [Boolean] Make an allbut summarization?
      attr_reader :allbut

      # Creates an Aggregate instance
      def initialize(operand, by, summarization, allbut)
        @operand = operand
        @by = by
        @summarization = summarization
        @allbut = allbut
      end

      # (see Cog#each)
      def each
        index = Materialize::Hash.new(operand, by, allbut)
        index.each_pair do |k, v|
          yield k.merge(summarization.summarize(v))
        end
      end

    end # class Summarize::Cesure
  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/summarize/hash.rb
alf-0.12.1 lib/alf-engine/alf/engine/summarize/hash.rb
alf-0.12.0 lib/alf-engine/alf/engine/summarize/hash.rb
alf-0.11.1 lib/alf-engine/alf/engine/summarize/hash.rb
alf-0.11.0 lib/alf-engine/alf/engine/summarize/hash.rb