Sha256: ef88623187caa27c988718e3648a4479782d2577f763313a39c32b2737ff7320
Contents?: true
Size: 576 Bytes
Versions: 2
Compression:
Stored size: 576 Bytes
Contents
# frozen_string_literal: true require_relative '../mixins/packer' module Trifle module Stats module Driver class Process include Mixins::Packer def initialize @data = {} end def inc(key:, **values) self.class.pack(hash: values).each do |k, c| d = @data.fetch(key, {}) d[k] = d[k].to_i + c @data[key] = d end end def get(key:) self.class.unpack( hash: @data.fetch(key, {}) ) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
trifle-stats-0.2.0 | lib/trifle/stats/driver/process.rb |
trifle-stats-0.1.0 | lib/trifle/stats/driver/process.rb |