Sha256: 97f5038dd7a4eb4184aacea88df47233a461dc67350fc6f080d8ef54c8f6d54a

Contents?: true

Size: 794 Bytes

Versions: 2

Compression:

Stored size: 794 Bytes

Contents

module ReportsKits
  class ModelConfiguration
    attr_accessor :aggregations, :contextual_filters, :dimensions, :filters

    def initialize
      self.aggregations = []
      self.contextual_filters = []
      self.dimensions = []
      self.filters = []
    end

    def aggregation(key, expression, properties = {})
      aggregations << { key: key.to_s, expression: expression }.merge(properties).symbolize_keys
    end

    def contextual_filter(key, method)
      contextual_filters << { key: key, method: method }
    end

    def dimension(key, properties)
      dimensions << { key: key.to_s }.merge(properties).symbolize_keys
    end

    def filter(key, type_key, properties)
      filters << { key: key.to_s, type_key: type_key }.merge(properties).symbolize_keys
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reports_kits-0.7.8 lib/reports_kits/model_configuration.rb
reports_kits-0.7.7 lib/reports_kits/model_configuration.rb