summaryrefslogtreecommitdiff
path: root/classes/Net/SSH/Multi/Server.html
blob: 61a38cf4247b744e0af352a1a7a582d59b57ca11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
<!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</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) {
          window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
        }
        
        function toggleCode(id) {
          var code = document.getElementById(id)
        
          code.style.display = code.style.display != 'block' ? 'block' : 'none'
          return true
        }
        
        // Make codeblocks hidden by default
        document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
      //]]>
    </script>
  </head>
  <body class='page'>
    <div class='class' id='wrapper'>
      <div class='header'>
        <h1 class='name'>
          <span class='type'>class</span>
          Net::SSH::Multi::Server
        </h1>
        <ol class='paths'>
          <li>
            <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><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
            as the <a href="../../SSH.html">Net::SSH</a> session corresponding to that
            information. You'll rarely need to instantiate one of these directly:
            instead, you should use <a
            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>
            <ol>
              <li><a target="docwin" href="#method-c-new">new</a></li>
            </ol>
            <h3>Public Instance</h3>
            <ol>
              <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'>
            <div id='includes'>
              <h2>Included modules</h2>
              <ol>
                <li>Comparable</li>
              </ol>
            </div>
          </div>
          <div id='section'>
            <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'>
                      <a name='attribute-i-gateway'>gateway</a>
                    </td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'>
                      
                      <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'>
                      <a name='attribute-i-host'>host</a>
                    </td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'>
                      
                      <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'>
                      <a name='attribute-i-master'>master</a>
                    </td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'>
                      
                      <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'>
                      <a name='attribute-i-options'>options</a>
                    </td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'>
                      
                      <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).</p>
                    </td>
                  </tr>
                  <tr class='top-aligned-row context-row'>
                    <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'>
                      
                      <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-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 <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 =&gt; a Net::SSH::Gateway instance to use when establishing a
                  connection to this server.</p>
                  </li><li>
                  <p>:user =&gt; the name of the user to use when logging into this server.</p>
                  </li></ul>
                  
                  <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
                  <code>options</code>:</p>
                  
                  <pre>server = Net::SSH::Multi::Server.new(session, 'user@host:1234')&#x000A;puts server.user #-&gt; user&#x000A;puts server.port #-&gt; 1234</pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-c-new-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-c-new-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 43</span>&#x000A;<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>={})&#x000A;  <span class="ruby-ivar">@master</span> = <span class="ruby-identifier">master</span>&#x000A;  <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">dup</span>&#x000A;&#x000A;  <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>]&#x000A;&#x000A;  <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>)&#x000A;&#x000A;  <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>&#x000A;  <span class="ruby-identifier">port</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">port_opt</span>&#x000A;&#x000A;  <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>&#x000A;&#x000A;  <span class="ruby-ivar">@gateway</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:via</span>)&#x000A;  <span class="ruby-ivar">@failed</span> = <span class="ruby-keyword">false</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <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='arguments'>(server)</span>
                </div>
                <div class='description'>
                  
                  <p>Gives server definitions a sort order, and allows comparison.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-3C-3D-3E-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-3C-3D-3E-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 79</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-operator">&lt;=&gt;</span>(<span class="ruby-identifier">server</span>)&#x000A;  [<span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">user</span>] <span class="ruby-operator">&lt;=&gt;</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>]&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <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 <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('method-i-5B-5D-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-5B-5D-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 63</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>)&#x000A;  (<span class="ruby-identifier">options</span>[<span class="ruby-value">:properties</span>] <span class="ruby-operator">||</span> {})[<span class="ruby-identifier">key</span>]&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <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 <code>:properties</code> key in the
                  options hash. If the options hash has no :properties key, it will be
                  created.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-5B-5D-3D-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-5B-5D-3D-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 69</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)&#x000A;  (<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>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <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 <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('method-i-busy-3F-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-busy-3F-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 143</span>&#x000A;<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>)&#x000A;  <span class="ruby-identifier">session</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">session</span>.<span class="ruby-identifier">busy?</span>(<span class="ruby-identifier">include_invisible</span>)&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <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>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-close-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-close-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 149</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">close</span>&#x000A;  <span class="ruby-identifier">session</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">session</span>&#x000A;<span class="ruby-keyword">ensure</span>&#x000A;  <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>&#x000A;  <span class="ruby-ivar">@session</span> = <span class="ruby-keyword">nil</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <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 <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('method-i-fail-21-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-fail-21-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 115</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">fail!</span>(<span class="ruby-identifier">flag</span>=<span class="ruby-keyword">true</span>)&#x000A;  <span class="ruby-ivar">@failed</span> = <span class="ruby-identifier">flag</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <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 <code>true</code> if this server has ever failed a connection
                  attempt.</p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-failed-3F-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-failed-3F-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 108</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">failed?</span>&#x000A;  <span class="ruby-ivar">@failed</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <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 <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('method-i-hash-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-hash-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 89</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">hash</span>&#x000A;  <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>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <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>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-inspect-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-inspect-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 103</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">inspect</span>&#x000A;  <span class="ruby-ivar">@inspect</span> <span class="ruby-operator">||=</span> <span class="ruby-node">&quot;#&lt;%s:0x%x %s&gt;&quot;</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>]&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <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>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-port-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-port-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 74</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">port</span>&#x000A;  <span class="ruby-identifier">options</span>[<span class="ruby-value">:port</span>] <span class="ruby-operator">||</span> <span class="ruby-value">22</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <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 <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?&#x000A;  puts &quot;connecting...&quot;&#x000A;  server.session(true)&#x000A;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>
                  
                  <pre>assert_equal server, server.session[:server]</pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-session-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-session-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 136</span>&#x000A;<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>)&#x000A;  <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>&#x000A;  <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>)&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <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>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-to_s-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-to_s-source'><span class="ruby-comment"># File lib/net/ssh/multi/server.rb, line 94</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>&#x000A;  <span class="ruby-ivar">@to_s</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword">begin</span>&#x000A;    <span class="ruby-identifier">s</span> = <span class="ruby-node">&quot;#{user}@#{host}&quot;</span>&#x000A;    <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;:#{options[:port]}&quot;</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value">:port</span>]&#x000A;    <span class="ruby-identifier">s</span>&#x000A;  <span class="ruby-keyword">end</span>&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div id='footer-push'></div>
    </div>
    <div id='footer'>
      <a target="docwin" href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
    </div>
  </body>
</html>