Class: LogfileInterval::Aggregator::FirstValue

Inherits:
Base
  • Object
show all
Defined in:
lib/logfile_interval/aggregator/first_value.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 = {}) ⇒ FirstValue

Returns a new instance of FirstValue.



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

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

Instance Method Details

#add(value, group_by = nil) ⇒ Object



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

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