summaryrefslogtreecommitdiff
path: root/classes/Net/SSH/Multi/ChannelProxy.html
blob: 7a529c3b97c96902f4be695082b1a29ede674e97 (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
<!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::ChannelProxy [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::ChannelProxy
        </h1>
        <ol class='paths'>
          <li>
            <a href="../../../../files/lib/net/ssh/multi/channel_proxy_rb.html">lib/net/ssh/multi/channel_proxy.rb</a>
          </li>
        </ol>
        <div class='parent'>
          Parent:
          <strong>Object</strong>
        </div>
      </div>
      <div id='content'>
        <div id='text'>
          <div id='description'>
            <p>
            The <a href="ChannelProxy.html">ChannelProxy</a> is a delegate class that
            represents a channel that has not yet been opened. It is only used when <a
            href="../Multi.html">Net::SSH::Multi</a> is running with with a concurrent
            connections limit (see Net::SSH::Multi::Session#concurrent_connections).
            </p>
            <p>
            You&#8217;ll never need to instantiate one of these directly, and will
            probably (if all goes well!) never even notice when one of these is in use.
            Essentially, it is spawned by a <a
            href="PendingConnection.html">Net::SSH::Multi::PendingConnection</a> when
            the pending connection is asked to open a channel. Any actions performed on
            the channel proxy will then be recorded, until a real channel is set as the
            delegate (see <a href="ChannelProxy.html#M000028">delegate_to</a>). At that
            point, all recorded actions will be replayed on the channel, and any
            subsequent actions will be immediately delegated to the channel.
            </p>
          </div>
          <div id='method-list'>
            <h2>Methods</h2>
            <h3>public class</h3>
            <ol>
              <li><a href="#M000027">new</a></li>
            </ol>
            <h3>public instance</h3>
            <ol>
              <li><a href="#M000028">delegate_to</a></li>
              <li><a href="#M000029">method_missing</a></li>
            </ol>
          </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'>on_confirm</td>
                    <td class='context-item-value'>[R]</td>
                    <td class='context-item-desc'>
                      
                      This is the &#8220;on confirm&#8221; callback that gets called when the
                      real channel is opened.
                    </td>
                  </tr>
                </table>
              </div>
            </div>
            <div id='methods'>
              <h2>Public class methods</h2>
              <div class='method public-class' id='method-M000027'>
                <a name='M000027'>      </a>
                <div class='synopsis'>
                  <span class='name'>new</span>
                  <span class='arguments'>(&amp;on_confirm)</span>
                </div>
                <div class='description'>
                  <p>
                  Instantiates a new channel proxy with the given <tt>on_confirm</tt>
                  callback.
                  </p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('M000027-source'); return false">
                    [show source]
                  </a>
                  <pre id='M000027-source'>    <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel_proxy.rb, line 21</span>&#x000A;21:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">on_confirm</span>)&#x000A;22:       <span class="ruby-ivar">@on_confirm</span> = <span class="ruby-identifier">on_confirm</span>&#x000A;23:       <span class="ruby-ivar">@recordings</span> = []&#x000A;24:       <span class="ruby-ivar">@channel</span> = <span class="ruby-keyword kw">nil</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-M000028'>
                <a name='M000028'>      </a>
                <div class='synopsis'>
                  <span class='name'>delegate_to</span>
                  <span class='arguments'>(channel)</span>
                </div>
                <div class='description'>
                  <p>
                  Instructs the proxy to delegate all further actions to the given
                  <tt>channel</tt> (which must be an instance of
                  Net::SSH::Connection::Channel). All recorded actions are immediately
                  replayed, in order, against the delegate channel.
                  </p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('M000028-source'); return false">
                    [show source]
                  </a>
                  <pre id='M000028-source'>    <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel_proxy.rb, line 30</span>&#x000A;30:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delegate_to</span>(<span class="ruby-identifier">channel</span>)&#x000A;31:       <span class="ruby-ivar">@channel</span> = <span class="ruby-identifier">channel</span>&#x000A;32:       <span class="ruby-ivar">@recordings</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sym</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">block</span><span class="ruby-operator">|</span>&#x000A;33:         <span class="ruby-ivar">@channel</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A;34:       <span class="ruby-keyword kw">end</span>&#x000A;35:     <span class="ruby-keyword kw">end</span></pre>
                </div>
              </div>
              <div class='method public-instance' id='method-M000029'>
                <a name='M000029'>      </a>
                <div class='synopsis'>
                  <span class='name'>method_missing</span>
                  <span class='arguments'>(sym, *args, &amp;block)</span>
                </div>
                <div class='description'>
                  <p>
                  If a channel delegate has been specified (see <a
                  href="ChannelProxy.html#M000028">delegate_to</a>), the method will be
                  immediately sent to the delegate. Otherwise, the call is added to the list
                  of recorded method calls, to be played back when a delegate is specified.
                  </p>
                </div>
                <div class='source'>
                  <a class='source-toggle' href='#' onclick="toggleCode('M000029-source'); return false">
                    [show source]
                  </a>
                  <pre id='M000029-source'>    <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel_proxy.rb, line 41</span>&#x000A;41:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A;42:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@channel</span>&#x000A;43:         <span class="ruby-ivar">@channel</span>.<span class="ruby-identifier">__send__</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A;44:       <span class="ruby-keyword kw">else</span>&#x000A;45:         <span class="ruby-ivar">@recordings</span> <span class="ruby-operator">&lt;&lt;</span> [<span class="ruby-identifier">sym</span>, <span class="ruby-identifier">args</span>, <span class="ruby-identifier">block</span>]&#x000A;46:       <span class="ruby-keyword kw">end</span>&#x000A;47:     <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>