Class: LogfileInterval::Aggregator::Count

Inherits:
Base
  • Object
show all
Defined in:
lib/logfile_interval/aggregator/count.rb

Instance Attribute Summary

Attributes inherited from Base

#name

Instance Method Summary collapse

Methods inherited from Base

#initialize, #value, #values

Methods included from Registrar

#aggregator_classes, #all, #exist?, #inherited, #klass, #register_aggregator

Constructor Details

This class inherits a constructor from LogfileInterval::Aggregator::Base

Instance Method Details

#add(value, group_by_value = nil) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/logfile_interval/aggregator/count.rb', line 8

def add(value, group_by_value = nil)
  if group_by_value
    @val.increment_subkey(value, key(group_by_value))
  else
    @val.increment(value)
  end
end

#eachObject



4
5
6
# File 'lib/logfile_interval/aggregator/count.rb', line 4

def each
  @val.each { |k, v| yield k, v }
end