Sha256: d30a15a42e6744ad3a00a8a2c1f4f5afc73ede7fe80de3f1e487b24cbe39480f

Contents?: true

Size: 519 Bytes

Versions: 18

Compression:

Stored size: 519 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

18 entries across 18 versions & 1 rubygems

Version Path
harness-0.3.0 lib/harness/gauge.rb
harness-0.2.16 lib/harness/gauge.rb
harness-0.2.15 lib/harness/gauge.rb
harness-0.2.14 lib/harness/gauge.rb
harness-0.2.13 lib/harness/gauge.rb
harness-0.2.12 lib/harness/gauge.rb
harness-0.2.11 lib/harness/gauge.rb
harness-0.2.10 lib/harness/gauge.rb
harness-0.2.9 lib/harness/gauge.rb
harness-0.2.8 lib/harness/gauge.rb
harness-0.2.7 lib/harness/gauge.rb
harness-0.2.6 lib/harness/gauge.rb
harness-0.2.5 lib/harness/gauge.rb
harness-0.2.4 lib/harness/gauge.rb
harness-0.2.3 lib/harness/gauge.rb
harness-0.2.2 lib/harness/gauge.rb
harness-0.2.1 lib/harness/gauge.rb
harness-0.2.0 lib/harness/gauge.rb