Sha256: e591478eb254eb1170540062b76fd13c9b8bf2d734656594cdc4b6266ef00156
Contents?: true
Size: 502 Bytes
Versions: 1
Compression:
Stored size: 502 Bytes
Contents
module Metrics module Instruments class Gauge attr_reader :units def initialize(options = {}, &block) raise ArgumentError, "a block is required" unless block_given? @block = block @units = options[:units] end def get instance_exec(&@block) end def as_json(*_) value = get value.respond_to?(:as_json) ? value.as_json : value end def to_json(*_) as_json.to_json end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby-metrics-0.9.0 | lib/ruby-metrics/instruments/gauge.rb |