summaryrefslogtreecommitdiff
path: root/classes/Net/SSH/Multi/Subsession.html
blob: 6eda395a1b786661ba1cef88480e082e06b8a7ce (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
<!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::Subsession</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::Subsession
        </h1>
        <ol class='paths'>
          <li>
            <a target="docwin" href="../../../../files/lib/net/ssh/multi/subsession_rb.html">lib/net/ssh/multi/subsession.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>A trivial class for representing a subset of servers. It is used internally
            for restricting operations to a subset of all defined servers.</p>
            
            <pre>subsession = session.with(:app)&#x000A;subsession.exec(&quot;hostname&quot;)</pre>
          </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-first">first</a></li>
              <li><a target="docwin" href="#attribute-i-master">master</a></li>
              <li><a target="docwin" href="#attribute-i-servers">servers</a></li>
              <li><a target="docwin" href="#method-i-slice">slice</a></li>
            </ol>
          </div>
          <div id='context'>
            <div id='includes'>
              <h2>Included modules</h2>
              <ol>
                <li><a target="docwin" href="SessionActions.html">SessionActions</a></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-master'>master</a>
                    </td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'>
                      
                      <p>The master session that spawned this subsession.</p>
                    </td>
                  </tr>
                  <tr class='top-aligned-row context-row'>
                    <td class='context-item-name'>
                      <a name='attribute-i-servers'>servers</a>
                    </td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'>
                      
                      <p>The list of servers that this subsession can operate on.</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, server_list)</span>
                </div>
                <div class='description'>
                  
                  <p>Create a new subsession of the given <tt>master</tt> session, that operates
                  on the given <tt>server_list</tt>.</p>
                </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/subsession.rb, line 22</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">master</span>, <span class="ruby-identifier">server_list</span>)&#x000A;  <span class="ruby-ivar">@master</span>  = <span class="ruby-identifier">master</span>&#x000A;  <span class="ruby-ivar">@servers</span> = <span class="ruby-identifier">server_list</span>.<span class="ruby-identifier">uniq</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-first'>
                <a name='method-i-first'></a>
                <div class='synopsis'>
                  <span class='name'>first</span>
                  <span class='arguments'>()</span>
                </div>
                <div class='description'>
                  
                  <p>Returns a new subsession that consists of only the first server in the
                  server list of the current subsession. This is just convenience for <a
                  href="Subsession.html#method-i-slice">slice(0)</a>:</p>
                  
                  <pre>s1 = subsession.first</pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-first-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-first-source'><span class="ruby-comment"># File lib/net/ssh/multi/subsession.rb, line 43</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">first</span>&#x000A;  <span class="ruby-identifier">slice</span>(<span class="ruby-value">0</span>)&#x000A;<span class="ruby-keyword">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-method-i-slice'>
                <a name='method-i-slice'></a>
                <div class='synopsis'>
                  <span class='name'>slice</span>
                  <span class='arguments'>(*args)</span>
                </div>
                <div class='description'>
                  
                  <p>Works as Array#slice, but returns a new subsession consisting of the given
                  slice of servers in this subsession. The new subsession will have the same
                  <a href="Subsession.html#attribute-i-master">master</a> session as this
                  subsession does.</p>
                  
                  <pre>s1 = subsession.slice(0)&#x000A;s2 = subsession.slice(3, -1)&#x000A;s3 = subsession.slice(1..4)</pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('method-i-slice-source'); return false">
                    [show source]
                  </a>
                  <pre id='method-i-slice-source'><span class="ruby-comment"># File lib/net/ssh/multi/subsession.rb, line 34</span>&#x000A;<span class="ruby-keyword">def</span> <span class="ruby-identifier">slice</span>(*<span class="ruby-identifier">args</span>)&#x000A;  <span class="ruby-constant">Subsession</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">master</span>, <span class="ruby-constant">Array</span>(<span class="ruby-identifier">servers</span>.<span class="ruby-identifier">slice</span>(*<span class="ruby-identifier">args</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>