Class: Multimeter::Aggregate
- Inherits:
-
Object
- Object
- Multimeter::Aggregate
- Defined in:
- lib/multimeter.rb
Instance Method Summary collapse
-
#initialize(metrics) ⇒ Aggregate
constructor
A new instance of Aggregate.
- #to_h ⇒ Object
Constructor Details
#initialize(metrics) ⇒ Aggregate
Returns a new instance of Aggregate.
518 519 520 521 |
# File 'lib/multimeter.rb', line 518 def initialize(metrics) @metrics = metrics @type = check_type! end |
Instance Method Details
#to_h ⇒ Object
523 524 525 526 527 528 529 |
# File 'lib/multimeter.rb', line 523 def to_h { :type => :aggregate, :total => compute_total, :parts => Hash[@metrics.map { |k, v| [k.to_s, v.to_h] }] } end |