class LogfileInterval::Aggregator::Delta
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
LogfileInterval::Aggregator::Base::new
# File lib/logfile_interval/aggregator/delta.rb, line 4 def initialize(options = {}) @previous = Util::Counter.new super end
Public Instance Methods
add(value, group_by_value = nil)
click to toggle source
# File lib/logfile_interval/aggregator/delta.rb, line 9 def add(value, group_by_value = nil) if @previous.has_key?(key(group_by_value)) @val.add(key(group_by_value), value - @previous[key(group_by_value)]) @size.increment(key(group_by_value)) end @previous.set(key(group_by_value), value) end
val(k)
click to toggle source
# File lib/logfile_interval/aggregator/delta.rb, line 17 def val(k) average(k) end