class SmsLogparser::DataCache
Attributes
cache[R]
Public Class Methods
new()
click to toggle source
# File lib/sms-logparser/data_cache.rb, line 6 def initialize @cache = Hash.new end
Public Instance Methods
add(data)
click to toggle source
# File lib/sms-logparser/data_cache.rb, line 10 def add(data) key = [data[:customer_id], data[:author_id], data[:project_id], data[:type]].join('.') @cache[key] = @cache[key].to_i + data[:value].to_i @cache end
data_sets()
click to toggle source
# File lib/sms-logparser/data_cache.rb, line 16 def data_sets @cache.map do |key, value| key_components = key.split('.') { customer_id: key_components[0], author_id: key_components[1], project_id: key_components[2], type: key_components[3], value: value } end end