class Spectator::Measure

This immutable class represents a measurement sampled from a meter

Attributes

id[R]
value[R]

Public Class Methods

new(id, value) click to toggle source

A meter id and a value

# File lib/spectator/measure.rb, line 7
def initialize(id, value)
  @id = id
  @value = value.to_f
end

Public Instance Methods

==(other) click to toggle source

Compare this measurement against another one, taking into account nan values

# File lib/spectator/measure.rb, line 19
def ==(other)
  @id == other.id && (@value == other.value ||
      @value.nan? && other.value.nan?)
end
to_s() click to toggle source

A string representation of this measurement, for debugging purposes

# File lib/spectator/measure.rb, line 13
def to_s
  "Measure{id=#{@id}, value=#{@value}}"
end