Sha256: baf8ad36d91c5eb24e14ace9c9bbf085ec1bb070a072adaa87f176fe70d073f9
Contents?: true
Size: 680 Bytes
Versions: 3
Compression:
Stored size: 680 Bytes
Contents
# frozen_string_literal: true module DDMetrics class Metric include Enumerable def initialize @basic_metrics = {} end def get(label) basic_metric_for(label, BasicCounter) end def labels @basic_metrics.keys end def each @basic_metrics.each_key do |label| yield(label, get(label)) end end # @api private def basic_metric_for(label, basic_class) @basic_metrics.fetch(label) { @basic_metrics[label] = basic_class.new } end # @api private def validate_label(label) return if label.is_a?(Hash) raise ArgumentError, 'label argument must be a hash' end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ddmetrics-1.0.1 | lib/ddmetrics/metric.rb |
ddmetrics-1.0.0 | lib/ddmetrics/metric.rb |
ddmetrics-1.0.0rc1 | lib/ddmetrics/metric.rb |