1 <?xml version="1.0" encoding="iso-8859-1"?>
3 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
6 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
8 <title>Class: MCollective::Aggregate::Result::CollectionResult</title>
9 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10 <meta http-equiv="Content-Script-Type" content="text/javascript" />
11 <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
12 <script type="text/javascript">
15 function popupCode( url ) {
16 window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
19 function toggleCode( id ) {
20 if ( document.getElementById )
21 elem = document.getElementById( id );
22 else if ( document.all )
23 elem = eval( "document.all." + id );
27 elemStyle = elem.style;
29 if ( elemStyle.display != "block" ) {
30 elemStyle.display = "block"
32 elemStyle.display = "none"
38 // Make codeblocks hidden by default
39 document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
49 <div id="classHeader">
50 <table class="header-table">
51 <tr class="top-aligned-row">
52 <td><strong>Class</strong></td>
53 <td class="class-name-in-header">MCollective::Aggregate::Result::CollectionResult</td>
55 <tr class="top-aligned-row">
56 <td><strong>In:</strong></td>
58 <a href="../../../../files/lib/mcollective/aggregate/result/collection_result_rb.html">
59 lib/mcollective/aggregate/result/collection_result.rb
65 <tr class="top-aligned-row">
66 <td><strong>Parent:</strong></td>
75 <!-- banner header -->
77 <div id="bodyContent">
81 <div id="contextContent">
87 <div id="method-list">
88 <h3 class="section-bar">Methods</h3>
90 <div class="name-list">
91 <a href="#M000415">to_s</a>
109 <!-- if method_list -->
111 <h3 class="section-bar">Public Instance methods</h3>
113 <div id="method-M000415" class="method-detail">
114 <a name="M000415"></a>
116 <div class="method-heading">
117 <a href="#M000415" class="method-signature">
118 <span class="method-name">to_s</span><span class="method-args">()</span>
122 <div class="method-description">
123 <p><a class="source-toggle" href="#"
124 onclick="toggleCode('M000415-source');return false;">[Source]</a></p>
125 <div class="method-source-code" id="M000415-source">
127 <span class="ruby-comment cmt"># File lib/mcollective/aggregate/result/collection_result.rb, line 5</span>
128 5: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
129 6: <span class="ruby-keyword kw">return</span> <span class="ruby-value str">""</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@result</span>[<span class="ruby-identifier">:value</span>].<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-keyword kw">nil</span>)
131 8: <span class="ruby-identifier">result</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
133 10: <span class="ruby-ivar">@result</span>[<span class="ruby-identifier">:value</span>].<span class="ruby-identifier">sort</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>[<span class="ruby-value">1</span>] <span class="ruby-operator"><=></span> <span class="ruby-identifier">y</span>[<span class="ruby-value">1</span>]}.<span class="ruby-identifier">reverse</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
134 11: <span class="ruby-identifier">result</span>.<span class="ruby-identifier">puts</span> <span class="ruby-ivar">@aggregate_format</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">value</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">value</span>[<span class="ruby-value">1</span>]]
135 12: <span class="ruby-keyword kw">end</span>
137 14: <span class="ruby-identifier">result</span>.<span class="ruby-identifier">string</span>.<span class="ruby-identifier">chomp</span>
138 15: <span class="ruby-keyword kw">end</span>
151 <div id="validator-badges">
152 <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>