class Riemann::Babbler::Event

Public Class Methods

new(hash = nil) click to toggle source
Calls superclass method
# File lib/riemann/babbler/event.rb, line 16
def initialize(hash = nil)
  if hash
    super(hash)
    self.metric = hash[:metric] if hash[:metric]
  else
    super
  end
  @time ||= Time.now.to_i
end

Public Instance Methods

metric() click to toggle source
# File lib/riemann/babbler/event.rb, line 26
def metric
  metric_d || metric_sint64 || metric_f
end
metric=(m) click to toggle source
# File lib/riemann/babbler/event.rb, line 30
def metric=(m)
  if Integer === m and (-(2**63)...2**63) === m
    self.metric_sint64 = m
    self.metric_f = m.to_f
  else
    self.metric_d = m.to_f
    self.metric_f = m.to_f
  end
end