Sha256: 4518fab35dee6b098fb9a60618bf75a12db8ce00bc8915f7b63cb99a772733d2
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
module ReportsKit module Reports module Data class PopulateOneDimension attr_accessor :sparse_measures_dimension_keys_values def initialize(sparse_measures_dimension_keys_values) self.sparse_measures_dimension_keys_values = sparse_measures_dimension_keys_values end def perform return sparse_measures_dimension_keys_values if sparse_measures_dimension_keys_values.length == 1 measures_dimension_keys_values end private def measures_dimension_keys_values measures_dimension_keys_values = sparse_measures_dimension_keys_values.map do |measure, dimension_keys_values| dimension_keys.each do |key| dimension_keys_values[key] ||= 0 end [measure, dimension_keys_values] end Hash[measures_dimension_keys_values] end def dimension_keys sparse_measures_dimension_keys_values.map do |measure, dimension_keys_values| dimension_keys_values.keys end.reduce(&:+).uniq end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reports_kit-0.2.0 | lib/reports_kit/reports/data/populate_one_dimension.rb |