Class: LogfileInterval::Aggregator::Base
- Inherits:
-
Object
- Object
- LogfileInterval::Aggregator::Base
show all
- Extended by:
- Registrar
- Includes:
- Enumerable
- Defined in:
- lib/logfile_interval/aggregator/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Registrar
aggregator_classes, all, exist?, inherited, klass, register_aggregator
Constructor Details
#initialize(options = {}) ⇒ Base
12
13
14
15
16
17
|
# File 'lib/logfile_interval/aggregator/base.rb', line 12
def initialize(options = {})
@name = options[:name]
@val = Util::Counter.new
@size = Util::Counter.new
@options = options
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
10
11
12
|
# File 'lib/logfile_interval/aggregator/base.rb', line 10
def name
@name
end
|
Instance Method Details
#add(value, group_by_value = nil) ⇒ Object
31
32
33
|
# File 'lib/logfile_interval/aggregator/base.rb', line 31
def add(value, group_by_value = nil)
raise NotImplementedError
end
|
#value(group = nil) ⇒ Object
19
20
21
|
# File 'lib/logfile_interval/aggregator/base.rb', line 19
def value(group = nil)
val(key(group))
end
|
#values ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/logfile_interval/aggregator/base.rb', line 23
def values
if single_value?
value
else
self.inject({}) { |h, v| h[v[0]] = v[1]; h }
end
end
|