Class: MCollective::Aggregate::Base
- Inherits:
-
Object
- Object
- MCollective::Aggregate::Base
- Defined in:
- lib/mcollective/aggregate/base.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#aggregate_format ⇒ Object
Returns the value of attribute aggregate_format.
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#name ⇒ Object
Returns the value of attribute name.
-
#output_name ⇒ Object
Returns the value of attribute output_name.
-
#result ⇒ Object
Returns the value of attribute result.
Instance Method Summary collapse
-
#initialize(output_name, arguments, aggregate_format, action) ⇒ Base
constructor
A new instance of Base.
- #result_class(type) ⇒ Object
-
#summarize ⇒ Object
Stops execution of the function and returns a specific ResultObject, aggregate functions will most likely override this but this is the simplest case so we might as well default to that.
Constructor Details
#initialize(output_name, arguments, aggregate_format, action) ⇒ Base
Returns a new instance of Base.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/mcollective/aggregate/base.rb', line 6 def initialize(output_name, arguments, aggregate_format, action) @name = self.class.to_s @output_name = output_name # Any additional arguments passed in the ddl after the output field will # be stored in the arguments array which can be used in the function @arguments = arguments @aggregate_format = aggregate_format @action = action @result = {:value => nil, :type => nil, :output => output_name} startup_hook end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
4 5 6 |
# File 'lib/mcollective/aggregate/base.rb', line 4 def action @action end |
#aggregate_format ⇒ Object
Returns the value of attribute aggregate_format.
4 5 6 |
# File 'lib/mcollective/aggregate/base.rb', line 4 def aggregate_format @aggregate_format end |
#arguments ⇒ Object
Returns the value of attribute arguments.
4 5 6 |
# File 'lib/mcollective/aggregate/base.rb', line 4 def arguments @arguments end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/mcollective/aggregate/base.rb', line 4 def name @name end |
#output_name ⇒ Object
Returns the value of attribute output_name.
4 5 6 |
# File 'lib/mcollective/aggregate/base.rb', line 4 def output_name @output_name end |
#result ⇒ Object
Returns the value of attribute result.
4 5 6 |
# File 'lib/mcollective/aggregate/base.rb', line 4 def result @result end |
Instance Method Details
#result_class(type) ⇒ Object
35 36 37 |
# File 'lib/mcollective/aggregate/base.rb', line 35 def result_class(type) Result.const_get("#{type.to_s.capitalize}Result") end |
#summarize ⇒ Object
Stops execution of the function and returns a specific ResultObject, aggregate functions will most likely override this but this is the simplest case so we might as well default to that
29 30 31 32 33 |
# File 'lib/mcollective/aggregate/base.rb', line 29 def summarize raise "Result type is not set while trying to summarize aggregate function results" unless @result[:type] result_class(@result[:type]).new(@result, @aggregate_format, @action) end |