Sha256: 0b39e65eee68dc2e7c93f4469015a6bab47ec9269eec05bbe39db5d2cba28020

Contents?: true

Size: 521 Bytes

Versions: 8

Compression:

Stored size: 521 Bytes

Contents

module Harness
  class Gauge < Measurement
    def initialize(attributes = {})
      super
      self.units ||= :ms
    end

    def self.from_event(event)
      if event.payload[:gauge].is_a? Hash
        gauge = new event.payload[:gauge]
      elsif event.payload[:gauge].is_a?(Symbol) || event.payload[:gauge].is_a?(String)
        gauge = new :id => event.payload[:gauge].to_s
      else
        gauge = new
      end

      gauge.id ||= event.name
      gauge.value ||= event.duration

      gauge
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
harness-0.9.1 lib/harness/gauge.rb
harness-0.9.0 lib/harness/gauge.rb
harness-0.8.1 lib/harness/gauge.rb
harness-0.8.0 lib/harness/gauge.rb
harness-0.7.0 lib/harness/gauge.rb
harness-0.6.0 lib/harness/gauge.rb
harness-0.5.0 lib/harness/gauge.rb
harness-0.4.0 lib/harness/gauge.rb