Class: LogfileInterval::Aggregator::Appender

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

Instance Attribute Summary

Attributes inherited from Base

#name

Instance Method Summary collapse

Methods inherited from Base

#value, #values

Methods included from Registrar

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

Constructor Details

#initialize(options = {}) ⇒ Appender

Returns a new instance of Appender.



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

def initialize(options = {})
  super(options)
  @val = {}
end

Instance Method Details

#add(value, group_by = nil) ⇒ Object



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

def add(value, group_by = nil)
  @val[key(group_by)] ||= Set.new
  @val[key(group_by)].add(value)
  @size.increment(key(group_by))
end