Updated mcollective.init according to OSCI-658
[packages/precise/mcollective.git] / lib / mcollective / aggregate / result / collection_result.rb
diff --git a/lib/mcollective/aggregate/result/collection_result.rb b/lib/mcollective/aggregate/result/collection_result.rb
new file mode 100644 (file)
index 0000000..1ee01fc
--- /dev/null
@@ -0,0 +1,19 @@
+module MCollective
+  class Aggregate
+    module Result
+      class CollectionResult<Base
+        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
+      end
+    end
+  end
+end