diff options
Diffstat (limited to 'classes/Net/SSH/Multi/Server.html')
-rw-r--r-- | classes/Net/SSH/Multi/Server.html | 355 |
1 files changed, 172 insertions, 183 deletions
diff --git a/classes/Net/SSH/Multi/Server.html b/classes/Net/SSH/Multi/Server.html index 17be26b..61a38cf 100644 --- a/classes/Net/SSH/Multi/Server.html +++ b/classes/Net/SSH/Multi/Server.html @@ -1,9 +1,9 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang='en'> <head> - <title>: Net::SSH::Multi::Server [Control multiple Net::SSH connections via a single interface.]</title> - <meta content='text/html; charset=utf-8' http-equiv='Content-Type'> - <link href='../../../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'> + <title>Net::SSH::Multi::Server</title> + <meta content='text/html; charset=US-ASCII' http-equiv='Content-Type'> + <link href='../../../../css/style.css' media='screen' rel='stylesheet' type='text/css'> <script type='text/javascript'> //<![CDATA[ function popupCode(url) { @@ -26,50 +26,54 @@ <div class='class' id='wrapper'> <div class='header'> <h1 class='name'> - <span class='type'>Class</span> + <span class='type'>class</span> Net::SSH::Multi::Server </h1> <ol class='paths'> <li> - <a href="../../../../files/lib/net/ssh/multi/server_rb.html">lib/net/ssh/multi/server.rb</a> + <a target="docwin" href="../../../../files/lib/net/ssh/multi/server_rb.html">lib/net/ssh/multi/server.rb</a> </li> </ol> <div class='parent'> Parent: - <strong>Object</strong> + <strong><a target="docwin" href="../Multi.html">Multi</a></strong> </div> </div> <div id='content'> <div id='text'> <div id='description'> - <p> - Encapsulates the connection information for a single remote server, as well + + <p>Encapsulates the connection information for a single remote server, as well as the <a href="../../SSH.html">Net::SSH</a> session corresponding to that - information. You’ll rarely need to instantiate one of these directly: + information. You'll rarely need to instantiate one of these directly: instead, you should use <a - href="Session.html#M000069">Net::SSH::Multi::Session#use</a>. - </p> + href="Session.html#method-i-use">Net::SSH::Multi::Session#use</a>.</p> </div> <div id='method-list'> <h2>Methods</h2> - <h3>public class</h3> + <h3>Public Class</h3> <ol> - <li><a href="#M000046">new</a></li> + <li><a target="docwin" href="#method-c-new">new</a></li> </ol> - <h3>public instance</h3> + <h3>Public Instance</h3> <ol> - <li><a href="#M000050"><=></a></li> - <li><a href="#M000047">[]</a></li> - <li><a href="#M000048">[]=</a></li> - <li><a href="#M000057">busy?</a></li> - <li><a href="#M000058">close</a></li> - <li><a href="#M000055">fail!</a></li> - <li><a href="#M000054">failed?</a></li> - <li><a href="#M000051">hash</a></li> - <li><a href="#M000053">inspect</a></li> - <li><a href="#M000049">port</a></li> - <li><a href="#M000056">session</a></li> - <li><a href="#M000052">to_s</a></li> + <li><a target="docwin" href="#method-i-3C-3D-3E"><=></a></li> + <li><a target="docwin" href="#method-i-5B-5D">[]</a></li> + <li><a target="docwin" href="#method-i-5B-5D-3D">[]=</a></li> + <li><a target="docwin" href="#method-i-busy-3F">busy?</a></li> + <li><a target="docwin" href="#method-i-close">close</a></li> + <li><a target="docwin" href="#method-i-fail-21">fail!</a></li> + <li><a target="docwin" href="#method-i-failed-3F">failed?</a></li> + <li><a target="docwin" href="#attribute-i-gateway">gateway</a></li> + <li><a target="docwin" href="#method-i-hash">hash</a></li> + <li><a target="docwin" href="#attribute-i-host">host</a></li> + <li><a target="docwin" href="#method-i-inspect">inspect</a></li> + <li><a target="docwin" href="#attribute-i-master">master</a></li> + <li><a target="docwin" href="#attribute-i-options">options</a></li> + <li><a target="docwin" href="#method-i-port">port</a></li> + <li><a target="docwin" href="#method-i-session">session</a></li> + <li><a target="docwin" href="#method-i-to_s">to_s</a></li> + <li><a target="docwin" href="#attribute-i-user">user</a></li> </ol> </div> <div id='context'> @@ -81,348 +85,333 @@ </div> </div> <div id='section'> - <div id='aliases-list'> - <h2>External Aliases</h2> - <div class='name-list'> - <table summary='External aliases'> - <tr class='top-aligned-row context-row'> - <td class='context-item-name'>==</td> - <td>-></td> - <td class='context-item-value'>eql?</td> - </tr> - </table> - </div> - </div> <div id='attribute-list'> <h2 class='section-bar'>Attributes</h2> <div class='name-list'> <table> <tr class='top-aligned-row context-row'> - <td class='context-item-name'>gateway</td> + <td class='context-item-name'> + <a name='attribute-i-gateway'>gateway</a> + </td> <td class='context-item-value'>[R]</td> <td class='context-item-desc'> - The Net::SSH::Gateway instance to use to establish the connection. Will be - <tt>nil</tt> if the connection should be established without a gateway. + <p>The Net::SSH::Gateway instance to use to establish the connection. Will be + <code>nil</code> if the connection should be established without a gateway.</p> </td> </tr> <tr class='top-aligned-row context-row'> - <td class='context-item-name'>host</td> + <td class='context-item-name'> + <a name='attribute-i-host'>host</a> + </td> <td class='context-item-value'>[R]</td> <td class='context-item-desc'> - The host name (or IP address) of the server to connect to. + <p>The host name (or IP address) of the server to connect to.</p> </td> </tr> <tr class='top-aligned-row context-row'> - <td class='context-item-name'>master</td> + <td class='context-item-name'> + <a name='attribute-i-master'>master</a> + </td> <td class='context-item-value'>[R]</td> <td class='context-item-desc'> - The <a href="Session.html">Net::SSH::Multi::Session</a> instance that - manages this server instance. + <p>The <a href="Session.html">Net::SSH::Multi::Session</a> instance that + manages this server instance.</p> </td> </tr> <tr class='top-aligned-row context-row'> - <td class='context-item-name'>options</td> + <td class='context-item-name'> + <a name='attribute-i-options'>options</a> + </td> <td class='context-item-value'>[R]</td> <td class='context-item-desc'> - The Hash of additional options to pass to <a + <p>The Hash of additional options to pass to <a href="../../SSH.html">Net::SSH</a> when connecting (including things like - :password, and so forth). + :password, and so forth).</p> </td> </tr> <tr class='top-aligned-row context-row'> - <td class='context-item-name'>user</td> + <td class='context-item-name'> + <a name='attribute-i-user'>user</a> + </td> <td class='context-item-value'>[R]</td> <td class='context-item-desc'> - The user name to use when logging into the server. + <p>The user name to use when logging into the server.</p> </td> </tr> </table> </div> </div> <div id='methods'> - <h2>Public class methods</h2> - <div class='method public-class' id='method-M000046'> - <a name='M000046'> </a> + <h2>Public Class methods</h2> + <div class='method public-class' id='method-method-c-new'> + <a name='method-c-new'></a> <div class='synopsis'> <span class='name'>new</span> <span class='arguments'>(master, host, options={})</span> </div> <div class='description'> - <p> - Creates a new <a href="Server.html">Server</a> instance with the given - connection information. The <tt>master</tt> argument must be a reference to - the <a href="Session.html">Net::SSH::Multi::Session</a> instance that will - manage this server reference. The <tt>options</tt> hash must conform to the - options described for Net::SSH::start, with two additions: - </p> - <ul> - <li>:via => a Net::SSH::Gateway instance to use when establishing a connection - to this server. - </li> - <li>:user => the name of the user to use when logging into this server. + <p>Creates a new <a href="Server.html">Server</a> instance with the given + connection information. The <code>master</code> argument must be a + reference to the <a href="Session.html">Net::SSH::Multi::Session</a> + instance that will manage this server reference. The <code>options</code> + hash must conform to the options described for Net::SSH::start, with two + additions:</p> + <ul><li> + <p>:via => a Net::SSH::Gateway instance to use when establishing a + connection to this server.</p> + </li><li> + <p>:user => the name of the user to use when logging into this server.</p> + </li></ul> - </li> - </ul> - <p> - The <tt>host</tt> argument may include the username and port number, in + <p>The <code>host</code> argument may include the username and port number, in which case those values take precedence over similar values given in the - <tt>options</tt>: - </p> + <code>options</code>:</p> + <pre>server = Net::SSH::Multi::Server.new(session, 'user@host:1234')
puts server.user #-> user
puts server.port #-> 1234</pre> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000046-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('method-c-new-source'); return false"> [show source] </a> - <pre id='M000046-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/server.rb, line 43</span>
43: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">master</span>, <span class="ruby-identifier">host</span>, <span class="ruby-identifier">options</span>={})
44: <span class="ruby-ivar">@master</span> = <span class="ruby-identifier">master</span>
45: <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">dup</span>
46: 
47: <span class="ruby-ivar">@user</span>, <span class="ruby-ivar">@host</span>, <span class="ruby-identifier">port</span> = <span class="ruby-identifier">host</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/^(?:([^;,:=]+)@|)(.*?)(?::(\d+)|)$/</span>)[<span class="ruby-value">1</span>,<span class="ruby-value">3</span>]
48: 
49: <span class="ruby-identifier">user_opt</span>, <span class="ruby-identifier">port_opt</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:user</span>), <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:port</span>)
50: 
51: <span class="ruby-ivar">@user</span> = <span class="ruby-ivar">@user</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">user_opt</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">master</span>.<span class="ruby-identifier">default_user</span>
52: <span class="ruby-identifier">port</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">port_opt</span>
53: 
54: <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:port</span>] = <span class="ruby-identifier">port</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">port</span>
55: 
56: <span class="ruby-ivar">@gateway</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">:via</span>)
57: <span class="ruby-ivar">@failed</span> = <span class="ruby-keyword kw">false</span>
58: <span class="ruby-keyword kw">end</span></pre> + <pre id='method-c-new-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 43</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">master</span>, <span class="ruby-identifier">host</span>, <span class="ruby-identifier">options</span>={})
 <span class="ruby-ivar">@master</span> = <span class="ruby-identifier">master</span>
 <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">dup</span>

 <span class="ruby-ivar">@user</span>, <span class="ruby-ivar">@host</span>, <span class="ruby-identifier">port</span> = <span class="ruby-identifier">host</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">%r^(?:([^;,:=]+)@|)(.*?)(?::(\d+)|)$/</span>)[<span class="ruby-value">1</span>,<span class="ruby-value">3</span>]

 <span class="ruby-identifier">user_opt</span>, <span class="ruby-identifier">port_opt</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:user</span>), <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:port</span>)

 <span class="ruby-ivar">@user</span> = <span class="ruby-ivar">@user</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">user_opt</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">master</span>.<span class="ruby-identifier">default_user</span>
 <span class="ruby-identifier">port</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">port_opt</span>

 <span class="ruby-ivar">@options</span>[<span class="ruby-value">:port</span>] = <span class="ruby-identifier">port</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">port</span>

 <span class="ruby-ivar">@gateway</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:via</span>)
 <span class="ruby-ivar">@failed</span> = <span class="ruby-keyword">false</span>
<span class="ruby-keyword">end</span></pre> </div> </div> - <h2>Public instance methods</h2> - <div class='method public-instance' id='method-M000050'> - <a name='M000050'> </a> + <h2>Public Instance methods</h2> + <div class='method public-instance' id='method-method-i-3C-3D-3E'> + <a name='method-i-3C-3D-3E'></a> <div class='synopsis'> - <span class='name'><=></span> + <span class='name'><=></span> <span class='arguments'>(server)</span> </div> <div class='description'> - <p> - Gives server definitions a sort order, and allows comparison. - </p> + + <p>Gives server definitions a sort order, and allows comparison.</p> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000050-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('method-i-3C-3D-3E-source'); return false"> [show source] </a> - <pre id='M000050-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/server.rb, line 79</span>
79: <span class="ruby-keyword kw">def</span> <span class="ruby-operator"><=></span>(<span class="ruby-identifier">server</span>)
80: [<span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">user</span>] <span class="ruby-operator"><=></span> [<span class="ruby-identifier">server</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">server</span>.<span class="ruby-identifier">port</span>, <span class="ruby-identifier">server</span>.<span class="ruby-identifier">user</span>]
81: <span class="ruby-keyword kw">end</span></pre> + <pre id='method-i-3C-3D-3E-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 79</span>
<span class="ruby-keyword">def</span> <span class="ruby-operator"><=></span>(<span class="ruby-identifier">server</span>)
 [<span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">user</span>] <span class="ruby-operator"><=></span> [<span class="ruby-identifier">server</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">server</span>.<span class="ruby-identifier">port</span>, <span class="ruby-identifier">server</span>.<span class="ruby-identifier">user</span>]
<span class="ruby-keyword">end</span></pre> </div> </div> - <div class='method public-instance' id='method-M000047'> - <a name='M000047'> </a> + <div class='method public-instance' id='method-method-i-5B-5D'> + <a name='method-i-5B-5D'></a> <div class='synopsis'> <span class='name'>[]</span> <span class='arguments'>(key)</span> </div> <div class='description'> - <p> - Returns the value of the server property with the given <tt>key</tt>. <a - href="Server.html">Server</a> properties are described via the - <tt>:properties</tt> key in the options hash when defining the <a - href="Server.html">Server</a>. - </p> + + <p>Returns the value of the server property with the given <code>key</code>. + <a href="Server.html">Server</a> properties are described via the + <code>:properties</code> key in the options hash when defining the <a + href="Server.html">Server</a>.</p> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000047-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('method-i-5B-5D-source'); return false"> [show source] </a> - <pre id='M000047-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/server.rb, line 63</span>
63: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>)
64: (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:properties</span>] <span class="ruby-operator">||</span> {})[<span class="ruby-identifier">key</span>]
65: <span class="ruby-keyword kw">end</span></pre> + <pre id='method-i-5B-5D-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 63</span>
<span class="ruby-keyword">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>)
 (<span class="ruby-identifier">options</span>[<span class="ruby-value">:properties</span>] <span class="ruby-operator">||</span> {})[<span class="ruby-identifier">key</span>]
<span class="ruby-keyword">end</span></pre> </div> </div> - <div class='method public-instance' id='method-M000048'> - <a name='M000048'> </a> + <div class='method public-instance' id='method-method-i-5B-5D-3D'> + <a name='method-i-5B-5D-3D'></a> <div class='synopsis'> <span class='name'>[]=</span> <span class='arguments'>(key, value)</span> </div> <div class='description'> - <p> - Sets the given key/value pair in the <tt>:properties</tt> key in the + + <p>Sets the given key/value pair in the <code>:properties</code> key in the options hash. If the options hash has no :properties key, it will be - created. - </p> + created.</p> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000048-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('method-i-5B-5D-3D-source'); return false"> [show source] </a> - <pre id='M000048-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/server.rb, line 69</span>
69: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
70: (<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:properties</span>] <span class="ruby-operator">||=</span> {})[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>
71: <span class="ruby-keyword kw">end</span></pre> + <pre id='method-i-5B-5D-3D-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 69</span>
<span class="ruby-keyword">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)
 (<span class="ruby-identifier">options</span>[<span class="ruby-value">:properties</span>] <span class="ruby-operator">||=</span> {})[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>
<span class="ruby-keyword">end</span></pre> </div> </div> - <div class='method public-instance' id='method-M000057'> - <a name='M000057'> </a> + <div class='method public-instance' id='method-method-i-busy-3F'> + <a name='method-i-busy-3F'></a> <div class='synopsis'> <span class='name'>busy?</span> <span class='arguments'>(include_invisible=false)</span> </div> <div class='description'> - <p> - Returns <tt>true</tt> if the session has been opened, and the session is - currently busy (as defined by Net::SSH::Connection::Session#busy?). - </p> + + <p>Returns <code>true</code> if the session has been opened, and the session + is currently busy (as defined by Net::SSH::Connection::Session#busy?).</p> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000057-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('method-i-busy-3F-source'); return false"> [show source] </a> - <pre id='M000057-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/server.rb, line 143</span>
143: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">busy?</span>(<span class="ruby-identifier">include_invisible</span>=<span class="ruby-keyword kw">false</span>)
144: <span class="ruby-identifier">session</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">session</span>.<span class="ruby-identifier">busy?</span>(<span class="ruby-identifier">include_invisible</span>)
145: <span class="ruby-keyword kw">end</span></pre> + <pre id='method-i-busy-3F-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 143</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">busy?</span>(<span class="ruby-identifier">include_invisible</span>=<span class="ruby-keyword">false</span>)
 <span class="ruby-identifier">session</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">session</span>.<span class="ruby-identifier">busy?</span>(<span class="ruby-identifier">include_invisible</span>)
<span class="ruby-keyword">end</span></pre> </div> </div> - <div class='method public-instance' id='method-M000058'> - <a name='M000058'> </a> + <div class='method public-instance' id='method-method-i-close'> + <a name='method-i-close'></a> <div class='synopsis'> <span class='name'>close</span> <span class='arguments'>()</span> </div> <div class='description'> - <p> - Closes this server’s session. If the session has not yet been opened, - this does nothing. - </p> + + <p>Closes this server's session. If the session has not yet been opened, this + does nothing.</p> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000058-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('method-i-close-source'); return false"> [show source] </a> - <pre id='M000058-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/server.rb, line 149</span>
149: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span>
150: <span class="ruby-identifier">session</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">session</span>
151: <span class="ruby-keyword kw">ensure</span>
152: <span class="ruby-identifier">master</span>.<span class="ruby-identifier">server_closed</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">session</span>
153: <span class="ruby-ivar">@session</span> = <span class="ruby-keyword kw">nil</span>
154: <span class="ruby-keyword kw">end</span></pre> + <pre id='method-i-close-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 149</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">close</span>
 <span class="ruby-identifier">session</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">session</span>
<span class="ruby-keyword">ensure</span>
 <span class="ruby-identifier">master</span>.<span class="ruby-identifier">server_closed</span>(<span class="ruby-keyword">self</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">session</span>
 <span class="ruby-ivar">@session</span> = <span class="ruby-keyword">nil</span>
<span class="ruby-keyword">end</span></pre> </div> </div> - <div class='method public-instance' id='method-M000055'> - <a name='M000055'> </a> + <div class='method public-instance' id='method-method-i-fail-21'> + <a name='method-i-fail-21'></a> <div class='synopsis'> <span class='name'>fail!</span> <span class='arguments'>(flag=true)</span> </div> <div class='description'> - <p> - Indicates (by default) that this server has just failed a connection - attempt. If <tt>flag</tt> is false, this can be used to reset the failed - flag so that a retry may be attempted. - </p> + + <p>Indicates (by default) that this server has just failed a connection + attempt. If <code>flag</code> is false, this can be used to reset the + failed flag so that a retry may be attempted.</p> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000055-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('method-i-fail-21-source'); return false"> [show source] </a> - <pre id='M000055-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/server.rb, line 115</span>
115: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fail!</span>(<span class="ruby-identifier">flag</span>=<span class="ruby-keyword kw">true</span>)
116: <span class="ruby-ivar">@failed</span> = <span class="ruby-identifier">flag</span>
117: <span class="ruby-keyword kw">end</span></pre> + <pre id='method-i-fail-21-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 115</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">fail!</span>(<span class="ruby-identifier">flag</span>=<span class="ruby-keyword">true</span>)
 <span class="ruby-ivar">@failed</span> = <span class="ruby-identifier">flag</span>
<span class="ruby-keyword">end</span></pre> </div> </div> - <div class='method public-instance' id='method-M000054'> - <a name='M000054'> </a> + <div class='method public-instance' id='method-method-i-failed-3F'> + <a name='method-i-failed-3F'></a> <div class='synopsis'> <span class='name'>failed?</span> <span class='arguments'>()</span> </div> <div class='description'> - <p> - Returns <tt>true</tt> if this server has ever failed a connection attempt. - </p> + + <p>Returns <code>true</code> if this server has ever failed a connection + attempt.</p> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000054-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('method-i-failed-3F-source'); return false"> [show source] </a> - <pre id='M000054-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/server.rb, line 108</span>
108: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">failed?</span>
109: <span class="ruby-ivar">@failed</span>
110: <span class="ruby-keyword kw">end</span></pre> + <pre id='method-i-failed-3F-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 108</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">failed?</span>
 <span class="ruby-ivar">@failed</span>
<span class="ruby-keyword">end</span></pre> </div> </div> - <div class='method public-instance' id='method-M000051'> - <a name='M000051'> </a> + <div class='method public-instance' id='method-method-i-hash'> + <a name='method-i-hash'></a> <div class='synopsis'> <span class='name'>hash</span> <span class='arguments'>()</span> </div> <div class='description'> - <p> - Generates a <tt>Fixnum</tt> hash value for this object. This function has - the property that +a.eql?(b)+ implies +a.hash == b.hash+. The hash value is - used by class <tt>Hash</tt>. Any hash value that exceeds the capacity of a - <tt>Fixnum</tt> will be truncated before being used. - </p> + + <p>Generates a <code>Fixnum</code> hash value for this object. This function + has the property that +a.eql?(b)+ implies +a.hash == b.hash+. The hash + value is used by class <code>Hash</code>. Any hash value that exceeds the + capacity of a <code>Fixnum</code> will be truncated before being used.</p> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000051-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('method-i-hash-source'); return false"> [show source] </a> - <pre id='M000051-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/server.rb, line 89</span>
89: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">hash</span>
90: <span class="ruby-ivar">@hash</span> <span class="ruby-operator">||=</span> [<span class="ruby-identifier">host</span>, <span class="ruby-identifier">user</span>, <span class="ruby-identifier">port</span>].<span class="ruby-identifier">hash</span>
91: <span class="ruby-keyword kw">end</span></pre> + <pre id='method-i-hash-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 89</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">hash</span>
 <span class="ruby-ivar">@hash</span> <span class="ruby-operator">||=</span> [<span class="ruby-identifier">host</span>, <span class="ruby-identifier">user</span>, <span class="ruby-identifier">port</span>].<span class="ruby-identifier">hash</span>
<span class="ruby-keyword">end</span></pre> </div> </div> - <div class='method public-instance' id='method-M000053'> - <a name='M000053'> </a> + <div class='method public-instance' id='method-method-i-inspect'> + <a name='method-i-inspect'></a> <div class='synopsis'> <span class='name'>inspect</span> <span class='arguments'>()</span> </div> <div class='description'> - <p> - Returns a human-readable representation of this server instance. - </p> + + <p>Returns a human-readable representation of this server instance.</p> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000053-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('method-i-inspect-source'); return false"> [show source] </a> - <pre id='M000053-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/server.rb, line 103</span>
103: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
104: <span class="ruby-ivar">@inspect</span> <span class="ruby-operator">||=</span> <span class="ruby-value str">"#<%s:0x%x %s>"</span> <span class="ruby-operator">%</span> [<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">object_id</span>, <span class="ruby-identifier">to_s</span>]
105: <span class="ruby-keyword kw">end</span></pre> + <pre id='method-i-inspect-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 103</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">inspect</span>
 <span class="ruby-ivar">@inspect</span> <span class="ruby-operator">||=</span> <span class="ruby-node">"#<%s:0x%x %s>"</span> <span class="ruby-operator">%</span> [<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">name</span>, <span class="ruby-identifier">object_id</span>, <span class="ruby-identifier">to_s</span>]
<span class="ruby-keyword">end</span></pre> </div> </div> - <div class='method public-instance' id='method-M000049'> - <a name='M000049'> </a> + <div class='method public-instance' id='method-method-i-port'> + <a name='method-i-port'></a> <div class='synopsis'> <span class='name'>port</span> <span class='arguments'>()</span> </div> <div class='description'> - <p> - Returns the port number to use for this connection. - </p> + + <p>Returns the port number to use for this connection.</p> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000049-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('method-i-port-source'); return false"> [show source] </a> - <pre id='M000049-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/server.rb, line 74</span>
74: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">port</span>
75: <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:port</span>] <span class="ruby-operator">||</span> <span class="ruby-value">22</span>
76: <span class="ruby-keyword kw">end</span></pre> + <pre id='method-i-port-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 74</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">port</span>
 <span class="ruby-identifier">options</span>[<span class="ruby-value">:port</span>] <span class="ruby-operator">||</span> <span class="ruby-value">22</span>
<span class="ruby-keyword">end</span></pre> </div> </div> - <div class='method public-instance' id='method-M000056'> - <a name='M000056'> </a> + <div class='method public-instance' id='method-method-i-session'> + <a name='method-i-session'></a> <div class='synopsis'> <span class='name'>session</span> <span class='arguments'>(require_session=false)</span> </div> <div class='description'> - <p> - Returns the <a href="../../SSH.html">Net::SSH</a> session object for this - server. If <tt>require_session</tt> is false and the session has not - previously been created, this will return <tt>nil</tt>. If - <tt>require_session</tt> is true, the session will be instantiated if it - has not already been instantiated, via the <tt>gateway</tt> if one is - given, or directly (via Net::SSH::start) otherwise. - </p> + + <p>Returns the <a href="../../SSH.html">Net::SSH</a> session object for this + server. If <code>require_session</code> is false and the session has not + previously been created, this will return <code>nil</code>. If + <code>require_session</code> is true, the session will be instantiated if + it has not already been instantiated, via the <code>gateway</code> if one + is given, or directly (via Net::SSH::start) otherwise.</p> + <pre>if server.session.nil?
 puts "connecting..."
 server.session(true)
end</pre> - <p> - Note that the sessions returned by this are “enhanced” - slightly, to make them easier to deal with in a multi-session environment: - they have a :server property automatically set on them, that refers to this - object (the <a href="Server.html">Server</a> instance that spawned them). - </p> + + <p>Note that the sessions returned by this are "enhanced" slightly, to make + them easier to deal with in a multi-session environment: they have a + :server property automatically set on them, that refers to this object (the + <a href="Server.html">Server</a> instance that spawned them).</p> + <pre>assert_equal server, server.session[:server]</pre> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000056-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('method-i-session-source'); return false"> [show source] </a> - <pre id='M000056-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/server.rb, line 136</span>
136: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">session</span>(<span class="ruby-identifier">require_session</span>=<span class="ruby-keyword kw">false</span>)
137: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@session</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@session</span> <span class="ruby-operator">||</span> <span class="ruby-operator">!</span><span class="ruby-identifier">require_session</span>
138: <span class="ruby-ivar">@session</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">master</span>.<span class="ruby-identifier">next_session</span>(<span class="ruby-keyword kw">self</span>)
139: <span class="ruby-keyword kw">end</span></pre> + <pre id='method-i-session-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 136</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">session</span>(<span class="ruby-identifier">require_session</span>=<span class="ruby-keyword">false</span>)
 <span class="ruby-keyword">return</span> <span class="ruby-ivar">@session</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@session</span> <span class="ruby-operator">||</span> <span class="ruby-operator">!</span><span class="ruby-identifier">require_session</span>
 <span class="ruby-ivar">@session</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">master</span>.<span class="ruby-identifier">next_session</span>(<span class="ruby-keyword">self</span>)
<span class="ruby-keyword">end</span></pre> </div> </div> - <div class='method public-instance' id='method-M000052'> - <a name='M000052'> </a> + <div class='method public-instance' id='method-method-i-to_s'> + <a name='method-i-to_s'></a> <div class='synopsis'> <span class='name'>to_s</span> <span class='arguments'>()</span> </div> <div class='description'> - <p> - Returns a human-readable representation of this server instance. - </p> + + <p>Returns a human-readable representation of this server instance.</p> </div> <div class='source'> - <a class='source-toggle' href='#' onclick="toggleCode('M000052-source'); return false"> + <a class='source-toggle' href='#' onclick="toggleCode('method-i-to_s-source'); return false"> [show source] </a> - <pre id='M000052-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/server.rb, line 94</span>
 94: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
 95: <span class="ruby-ivar">@to_s</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">begin</span>
 96: <span class="ruby-identifier">s</span> = <span class="ruby-node">"#{user}@#{host}"</span>
 97: <span class="ruby-identifier">s</span> <span class="ruby-operator"><<</span> <span class="ruby-node">":#{options[:port]}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:port</span>]
 98: <span class="ruby-identifier">s</span>
 99: <span class="ruby-keyword kw">end</span>
100: <span class="ruby-keyword kw">end</span></pre> + <pre id='method-i-to_s-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 94</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
 <span class="ruby-ivar">@to_s</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>
 <span class="ruby-identifier">s</span> = <span class="ruby-node">"#{user}@#{host}"</span>
 <span class="ruby-identifier">s</span> <span class="ruby-operator"><<</span> <span class="ruby-node">":#{options[:port]}"</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:port</span>]
 <span class="ruby-identifier">s</span>
 <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre> </div> </div> </div> @@ -432,7 +421,7 @@ <div id='footer-push'></div> </div> <div id='footer'> - <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a> + <a target="docwin" href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a> </div> </body> </html> |