Class: LogfileInterval::Aggregator::Base
- Inherits:
-
Object
- Object
- LogfileInterval::Aggregator::Base
- Extended by:
- Registrar
- Includes:
- Enumerable
- Defined in:
- lib/logfile_interval/aggregator/base.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #add(value, group_by_value = nil) ⇒ Object
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
- #value(group = nil) ⇒ Object
- #values ⇒ Object
Methods included from Registrar
aggregator_classes, all, exist?, inherited, klass, register_aggregator
Constructor Details
Instance Attribute Details
#name ⇒ Object (readonly)
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 |