Sha256: d92af24e63d7946a6081a9febd22c64e9be88f53af7eff4c9598a0ca4d105346

Contents?: true

Size: 1.15 KB

Versions: 5

Compression:

Stored size: 1.15 KB

Contents

module Alf
  module Engine
    class Quota::Cesure < Cog
      include Engine::Cesure

      # @return [Enumerable] The operand
      attr_reader :operand

      # @return [AttrList] List of attributes for 'quota by'
      attr_reader :by

      # @return [Summarization] Quota computations as a summarization
      attr_reader :summarization

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

      protected

      # (see Operator::Cesure#project)
      def project(tuple)
        @by.project_tuple(tuple, false)
      end

      # (see Operator::Cesure#start_cesure)
      def start_cesure(key, receiver)
        @aggs = @summarization.least
      end

      # (see Operator::Cesure#accumulate_cesure)
      def accumulate_cesure(tuple, receiver)
        @aggs = @summarization.happens(@aggs, tuple)
        receiver.call tuple.merge(@summarization.finalize(@aggs))
      end

      # (see Cesure#flush_cesure)
      def flush_cesure(key, receiver)
      end

    end # class Quota::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/quota/cesure.rb
alf-0.12.1 lib/alf-engine/alf/engine/quota/cesure.rb
alf-0.12.0 lib/alf-engine/alf/engine/quota/cesure.rb
alf-0.11.1 lib/alf-engine/alf/engine/quota/cesure.rb
alf-0.11.0 lib/alf-engine/alf/engine/quota/cesure.rb