Class: Multimeter::Aggregate

Inherits:
Object
  • Object
show all
Defined in:
lib/multimeter.rb

Instance Method Summary collapse

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_hObject



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