Class: LogfileInterval::Aggregator::GroupAndCount

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

Instance Method Summary collapse

Methods inherited from Base

#initialize, #value, #values

Constructor Details

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

Instance Method Details

#add(value, group_by) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
# File 'lib/logfile_interval/aggregator/group_and_count.rb', line 8

def add(value, group_by)
  raise ArgumentError, 'group_by argument is mandatory for GroupAndCount#add' unless group_by
  @val.increment_subkey(value, key(group_by))
end

#eachObject



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

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