class PIM::Statistics::Statistic
Attributes
name[R]
Public Class Methods
new(name, params = {})
click to toggle source
# File statistics.rb, line 154 def initialize name, params = {}, &block @name = name @params = params @block = block end
Public Instance Methods
calculate_statistic(old_item, new_item)
click to toggle source
# File statistics.rb, line 160 def calculate_statistic old_item, new_item result = [] counts = StatisticCalculator.new(old_item, new_item, @params, &@block).counts counts.each_pair do |key, sub_counts| sub_counts.each_pair do |dimension, count| next if count.nil? or count == 0 sub_count = {} sub_count[:name] = name sub_count[:key] = key sub_count[:dimension] = dimension if dimension sub_count[:count] = count result << sub_count end end result end