Sha256: dbe9f3bcf7735a9a849af96b6bab430fa62e18fbeacccbffc993d2370e920860

Contents?: true

Size: 867 Bytes

Versions: 4

Compression:

Stored size: 867 Bytes

Contents

# frozen_string_literal: true

#
# Copyright (c) 2019-present, Blue Marble Payroll, LLC
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#

module Proforma
  module Modeling
    class DataTable
      # An Aggregator is a table aggregator function configuration.
      class Aggregator
        acts_as_hashable

        module Function
          SUM = :sum
          AVE = :ave
        end
        include Function

        attr_accessor :property

        attr_writer :function, :name

        def initialize(function: SUM, name: '', property: nil)
          @function = function
          @name     = name
          @property = property
        end

        def function
          @function || SUM
        end

        def name
          @name.to_s
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
proforma-1.0.2 lib/proforma/modeling/data_table/aggregator.rb
proforma-1.0.1 lib/proforma/modeling/data_table/aggregator.rb
proforma-1.0.0 lib/proforma/modeling/data_table/aggregator.rb
proforma-1.0.0.pre.alpha lib/proforma/modeling/data_table/aggregator.rb