Sha256: 48297037052cb779b105b543be62bad2a30da2c8245041799589a333c7084cc7
Contents?: true
Size: 1.02 KB
Versions: 5
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true require_relative '../mixins/packer' module Trifle module Stats module Driver class Process include Mixins::Packer def initialize @data = {} @separator = '::' end def inc(keys:, **values) keys.map do |key| self.class.pack(hash: values).each do |k, c| d = @data.fetch(key.join(@separator), {}) d[k] = d[k].to_i + c @data[key.join(@separator)] = d end end end def set(keys:, **values) keys.map do |key| self.class.pack(hash: values).each do |k, c| d = @data.fetch(key.join(@separator), {}) d[k] = c @data[key.join(@separator)] = d end end end def get(keys:) keys.map do |key| self.class.unpack( hash: @data.fetch(key.join(@separator), {}) ) end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems