class PIM::Statistics::OldChart

Attributes

name[R]

Public Class Methods

new(name) click to toggle source
# File statistics.rb, line 288
def initialize name
  @name = name
  @counter = {}
end

Public Instance Methods

[](key, *dimensions) click to toggle source
# File statistics.rb, line 293
def [] key, *dimensions
  @counter[key] ||= {}
  @counter[key][dimensions.join(':')] ||= OldCounter.new
end
as_json() click to toggle source
# File statistics.rb, line 298
def as_json
  json = []
  @counter.each do |key, value|
    value.each do |dimension, count|
      hash =  {
        :key => key,
        :count => count.as_json
      }
      hash[:dimension] = dimension if not PIM.is_empty? dimension
      json << hash
    end
  end
  json
end