Sha256: 01620390aed40731d7a02fadcf69e7cd48135050e611abe48000e6e68a3bc3ba
Contents?: true
Size: 578 Bytes
Versions: 8
Compression:
Stored size: 578 Bytes
Contents
module Nanoc::Telemetry class LabelledCounter def initialize @counters = {} end def increment(label) get(label).increment end def get(label) @counters.fetch(label) { @counters[label] = Counter.new } end def empty? @counters.empty? end def value(label) get(label).value end def values @counters.each_with_object({}) do |(label, counter), res| res[label] = counter.value end end def map @counters.map { |(label, counter)| yield(label, counter) } end end end
Version data entries
8 entries across 8 versions & 1 rubygems