summaryrefslogtreecommitdiff
path: root/classes/Net/SSH/Multi/Subsession.html
blob: e6268a7105bdf3cda9784ad566ebad00059c6b87 (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
<!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 [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'>
    <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 href="../../../../files/lib/net/ssh/multi/subsession_rb.html">lib/net/ssh/multi/subsession.rb</a>
          </li>
        </ol>
        <div class='parent'>
          Parent:
          <strong>Object</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 href="#M000078">new</a></li>
            </ol>
            <h3>public instance</h3>
            <ol>
              <li><a href="#M000080">first</a></li>
              <li><a href="#M000079">slice</a></li>
            </ol>
          </div>
          <div id='context'>
            <div id='includes'>
              <h2>Included modules</h2>
              <ol>
                <li><a 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'>master</td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'>
                      
                      The master session that spawned this subsession.
                    </td>
                  </tr>
                  <tr class='top-aligned-row context-row'>
                    <td class='context-item-name'>servers</td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'>
                      
                      The list of servers that this subsession can operate on.
                    </td>
                  </tr>
                </table>
              </div>
            </div>
            <div id='methods'>
              <h2>Public class methods</h2>
              <div class='method public-class' id='method-M000078'>
                <a name='M000078'>      </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('M000078-source'); return false">
                    [show source]
                  </a>
                  <pre id='M000078-source'>    <span class="ruby-comment cmt"># File lib/net/ssh/multi/subsession.rb, line 22</span>&#x000A;22:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">master</span>, <span class="ruby-identifier">server_list</span>)&#x000A;23:       <span class="ruby-ivar">@master</span>  = <span class="ruby-identifier">master</span>&#x000A;24:       <span class="ruby-ivar">@servers</span> = <span class="ruby-identifier">server_list</span>.<span class="ruby-identifier">uniq</span>&#x000A;25:     <span class="ruby-keyword kw">end</span></pre>
                </div>
              </div>
              <h2>Public instance methods</h2>
              <div class='method public-instance' id='method-M000080'>
                <a name='M000080'>      </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
                  slice(0):
                  </p>
                  <pre>s1 = subsession.first</pre>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('M000080-source'); return false">
                    [show source]
                  </a>
                  <pre id='M000080-source'>    <span class="ruby-comment cmt"># File lib/net/ssh/multi/subsession.rb, line 43</span>&#x000A;43:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">first</span>&#x000A;44:       <span class="ruby-identifier">slice</span>(<span class="ruby-value">0</span>)&#x000A;45:     <span class="ruby-keyword kw">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-M000079'>
                <a name='M000079'>      </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
                  master 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('M000079-source'); return false">
                    [show source]
                  </a>
                  <pre id='M000079-source'>    <span class="ruby-comment cmt"># File lib/net/ssh/multi/subsession.rb, line 34</span>&#x000A;34:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">slice</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)&#x000A;35:       <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-operator">*</span><span class="ruby-identifier">args</span>)))&#x000A;36:     <span class="ruby-keyword kw">end</span></pre>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div id='footer-push'></div>
    </div>
    <div id='footer'>
      <a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
    </div>
  </body>
</html>