Class: MCollective::Aggregate::Sum

Inherits:
Base
  • Object
show all
Defined in:
lib/mcollective/aggregate/sum.rb

Instance Attribute Summary

Attributes inherited from Base

#action, #aggregate_format, #arguments, #name, #output_name, #result

Instance Method Summary collapse

Methods inherited from Base

#initialize, #result_class, #summarize

Constructor Details

This class inherits a constructor from MCollective::Aggregate::Base

Instance Method Details

#process_result(value, reply) ⇒ Object

Determines the average of a set of numerical values



13
14
15
# File 'lib/mcollective/aggregate/sum.rb', line 13

def process_result(value, reply)
  @result[:value] += value
end

#startup_hookObject



4
5
6
7
8
9
10
# File 'lib/mcollective/aggregate/sum.rb', line 4

def startup_hook
  @result[:value] = 0
  @result[:type] = :numeric

  # Set default aggregate_function if it is undefined
  @aggregate_format ||= "Sum of #{@result[:output]}: %f"
end