Class: MCollective::Aggregate::Result::CollectionResult

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

Instance Attribute Summary

Attributes inherited from Base

#action, #aggregate_format, #result

Instance Method Summary collapse

Methods inherited from Base

#initialize, #result_type

Constructor Details

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

Instance Method Details

#to_sObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/mcollective/aggregate/result/collection_result.rb', line 5

def to_s
  return "" if @result[:value].keys.include?(nil)

  result = StringIO.new

  @result[:value].sort {|x, y| x[1] <=> y[1]}.reverse.each do |value|
    result.puts @aggregate_format % [value[0], value[1]]
  end

  result.string.chomp
end