summaryrefslogtreecommitdiff
path: root/classes/Net/SSH/Multi/Channel.html
diff options
context:
space:
mode:
Diffstat (limited to 'classes/Net/SSH/Multi/Channel.html')
-rw-r--r--classes/Net/SSH/Multi/Channel.html537
1 files changed, 537 insertions, 0 deletions
diff --git a/classes/Net/SSH/Multi/Channel.html b/classes/Net/SSH/Multi/Channel.html
new file mode 100644
index 0000000..779b48c
--- /dev/null
+++ b/classes/Net/SSH/Multi/Channel.html
@@ -0,0 +1,537 @@
+<!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::Channel [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::Channel
+ </h1>
+ <ol class='paths'>
+ <li>
+ <a href="../../../../files/lib/net/ssh/multi/channel_rb.html">lib/net/ssh/multi/channel.rb</a>
+ </li>
+ </ol>
+ <div class='parent'>
+ Parent:
+ <strong>Object</strong>
+ </div>
+ </div>
+ <div id='content'>
+ <div id='text'>
+ <div id='description'>
+ <p>
+ <a href="Channel.html">Net::SSH::Multi::Channel</a> encapsulates a
+ collection of Net::SSH::Connection::Channel instances from multiple
+ different connections. It allows for operations to be performed on all
+ contained channels, simultaneously, using an interface mostly identical to
+ Net::SSH::Connection::Channel itself.
+ </p>
+ <p>
+ You typically obtain a <a href="Channel.html">Net::SSH::Multi::Channel</a>
+ instance via Net::SSH::Multi::Session#open_channel or
+ Net::SSH::Multi::Session#exec, though there is nothing stopping you from
+ instantiating one yourself with a handful of Net::SSH::Connection::Channel
+ objects (though they should be associated with connections managed by a <a
+ href="Session.html">Net::SSH::Multi::Session</a> object for consistent
+ behavior).
+ </p>
+ <pre>channel = session.open_channel do |ch|&#x000A; # ...&#x000A;end&#x000A;&#x000A;channel.wait</pre>
+ </div>
+ <div id='method-list'>
+ <h2>Methods</h2>
+ <h3>public class</h3>
+ <ol>
+ <li><a href="#M000009">new</a></li>
+ </ol>
+ <h3>public instance</h3>
+ <ol>
+ <li><a href="#M000011">[]</a></li>
+ <li><a href="#M000012">[]=</a></li>
+ <li><a href="#M000016">active?</a></li>
+ <li><a href="#M000018">close</a></li>
+ <li><a href="#M000010">each</a></li>
+ <li><a href="#M000019">eof!</a></li>
+ <li><a href="#M000013">exec</a></li>
+ <li><a href="#M000023">on_close</a></li>
+ <li><a href="#M000020">on_data</a></li>
+ <li><a href="#M000024">on_eof</a></li>
+ <li><a href="#M000021">on_extended_data</a></li>
+ <li><a href="#M000025">on_open_failed</a></li>
+ <li><a href="#M000022">on_process</a></li>
+ <li><a href="#M000026">on_request</a></li>
+ <li><a href="#M000014">request_pty</a></li>
+ <li><a href="#M000015">send_data</a></li>
+ <li><a href="#M000017">wait</a></li>
+ </ol>
+ </div>
+ <div id='context'>
+ <div id='includes'>
+ <h2>Included modules</h2>
+ <ol>
+ <li>Enumerable</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'>channels</td>
+ <td class='context-item-value'>[R]</td>
+ <td class='context-item-desc'>
+
+ The collection of Net::SSH::Connection::Channel instances that this
+ multi-channel aggregates.
+ </td>
+ </tr>
+ <tr class='top-aligned-row context-row'>
+ <td class='context-item-name'>connection</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
+ controls this channel collection.
+ </td>
+ </tr>
+ <tr class='top-aligned-row context-row'>
+ <td class='context-item-name'>properties</td>
+ <td class='context-item-value'>[R]</td>
+ <td class='context-item-desc'>
+
+ A Hash of custom properties that may be set and queried on this object.
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ <div id='methods'>
+ <h2>Public class methods</h2>
+ <div class='method public-class' id='method-M000009'>
+ <a name='M000009'> </a>
+ <div class='synopsis'>
+ <span class='name'>new</span>
+ <span class='arguments'>(connection, channels)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Instantiate a new <a href="Channel.html">Net::SSH::Multi::Channel</a>
+ instance, controlled by the given <tt>connection</tt> (a <a
+ href="Session.html">Net::SSH::Multi::Session</a> object) and wrapping the
+ given <tt>channels</tt> (Net::SSH::Connection::Channel instances).
+ </p>
+ <p>
+ You will typically never call this directly; rather, you&#8217;ll get your
+ multi-channel references via Net::SSH::Multi::Session#open_channel and
+ friends.
+ </p>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000009-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000009-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 38</span>&#x000A;38: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">connection</span>, <span class="ruby-identifier">channels</span>)&#x000A;39: <span class="ruby-ivar">@connection</span> = <span class="ruby-identifier">connection</span>&#x000A;40: <span class="ruby-ivar">@channels</span> = <span class="ruby-identifier">channels</span>&#x000A;41: <span class="ruby-ivar">@properties</span> = {}&#x000A;42: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <h2>Public instance methods</h2>
+ <div class='method public-instance' id='method-M000011'>
+ <a name='M000011'> </a>
+ <div class='synopsis'>
+ <span class='name'>[]</span>
+ <span class='arguments'>(key)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Retrieve the property (see properties) with the given <tt>key</tt>.
+ </p>
+ <pre>host = channel[:host]</pre>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000011-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000011-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 53</span>&#x000A;53: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">key</span>)&#x000A;54: <span class="ruby-ivar">@properties</span>[<span class="ruby-identifier">key</span>]&#x000A;55: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-instance' id='method-M000012'>
+ <a name='M000012'> </a>
+ <div class='synopsis'>
+ <span class='name'>[]=</span>
+ <span class='arguments'>(key, value)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Set the property (see properties) with the given <tt>key</tt> to the given
+ <tt>value</tt>.
+ </p>
+ <pre>channel[:visited] = true</pre>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000012-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000012-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 61</span>&#x000A;61: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span>)&#x000A;62: <span class="ruby-ivar">@properties</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">value</span>&#x000A;63: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-instance' id='method-M000016'>
+ <a name='M000016'> </a>
+ <div class='synopsis'>
+ <span class='name'>active?</span>
+ <span class='arguments'>()</span>
+ </div>
+ <div class='description'>
+ <p>
+ Returns true as long as any of the component channels are active.
+ </p>
+ <pre>connection.loop { channel.active? }</pre>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000016-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000016-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 112</span>&#x000A;112: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">active?</span>&#x000A;113: <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">any?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">active?</span> }&#x000A;114: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-instance' id='method-M000018'>
+ <a name='M000018'> </a>
+ <div class='synopsis'>
+ <span class='name'>close</span>
+ <span class='arguments'>()</span>
+ </div>
+ <div class='description'>
+ <p>
+ Closes all component channels.
+ </p>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000018-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000018-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 127</span>&#x000A;127: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close</span>&#x000A;128: <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">close</span> }&#x000A;129: <span class="ruby-keyword kw">self</span>&#x000A;130: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-instance' id='method-M000010'>
+ <a name='M000010'> </a>
+ <div class='synopsis'>
+ <span class='name'>each</span>
+ <span class='arguments'>() {|channel| ...}</span>
+ </div>
+ <div class='description'>
+ <p>
+ Iterate over each component channel object, yielding each in order to the
+ associated block.
+ </p>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000010-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000010-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 46</span>&#x000A;46: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span>&#x000A;47: <span class="ruby-ivar">@channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">channel</span> }&#x000A;48: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-instance' id='method-M000019'>
+ <a name='M000019'> </a>
+ <div class='synopsis'>
+ <span class='name'>eof!</span>
+ <span class='arguments'>()</span>
+ </div>
+ <div class='description'>
+ <p>
+ Tells the remote process for each component channel not to expect any
+ further data from this end of the channel.
+ </p>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000019-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000019-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 134</span>&#x000A;134: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">eof!</span>&#x000A;135: <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">eof!</span> }&#x000A;136: <span class="ruby-keyword kw">self</span>&#x000A;137: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-instance' id='method-M000013'>
+ <a name='M000013'> </a>
+ <div class='synopsis'>
+ <span class='name'>exec</span>
+ <span class='arguments'>(command, &amp;block)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Perform an <tt>exec</tt> command on all component channels. The block, if
+ given, is passed to each component channel, so it will (potentially) be
+ invoked once for every channel in the collection. The block will receive
+ two parameters: the specific channel object being operated on, and a
+ boolean indicating whether the exec succeeded or not.
+ </p>
+ <pre>channel.exec &quot;ls -l&quot; do |ch, success|&#x000A; # ...&#x000A;end</pre>
+ <p>
+ See the documentation in <a href="../../SSH.html">Net::SSH</a> for
+ Net::SSH::Connection::Channel#exec for more information on how to work with
+ the callback.
+ </p>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000013-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000013-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 77</span>&#x000A;77: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exec</span>(<span class="ruby-identifier">command</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A;78: <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">exec</span>(<span class="ruby-identifier">command</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) }&#x000A;79: <span class="ruby-keyword kw">self</span>&#x000A;80: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-instance' id='method-M000023'>
+ <a name='M000023'> </a>
+ <div class='synopsis'>
+ <span class='name'>on_close</span>
+ <span class='arguments'>(&amp;block)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Registers a callback on all component channels, to be invoked when the
+ remote server terminates the channel. The callback will be invoked with one
+ argument: the specific channel object being closed.
+ </p>
+ <pre>channel.on_close do |ch|&#x000A; # ...&#x000A;end</pre>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000023-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000023-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 185</span>&#x000A;185: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">on_close</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A;186: <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_close</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) }&#x000A;187: <span class="ruby-keyword kw">self</span>&#x000A;188: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-instance' id='method-M000020'>
+ <a name='M000020'> </a>
+ <div class='synopsis'>
+ <span class='name'>on_data</span>
+ <span class='arguments'>(&amp;block)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Registers a callback on all component channels, to be invoked when the
+ remote process emits data (usually on its <tt>stdout</tt> stream). The
+ block will be invoked with two arguments: the specific channel object, and
+ the data that was received.
+ </p>
+ <pre>channel.on_data do |ch, data|&#x000A; puts &quot;got data: #{data}&quot;&#x000A;end</pre>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000020-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000020-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 147</span>&#x000A;147: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">on_data</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A;148: <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_data</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) }&#x000A;149: <span class="ruby-keyword kw">self</span>&#x000A;150: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-instance' id='method-M000024'>
+ <a name='M000024'> </a>
+ <div class='synopsis'>
+ <span class='name'>on_eof</span>
+ <span class='arguments'>(&amp;block)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Registers a callback on all component channels, to be invoked when the
+ remote server has no further data to send. The callback will be invoked
+ with one argument: the specific channel object being marked EOF.
+ </p>
+ <pre>channel.on_eof do |ch|&#x000A; # ...&#x000A;end</pre>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000024-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000024-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 197</span>&#x000A;197: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">on_eof</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A;198: <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_eof</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) }&#x000A;199: <span class="ruby-keyword kw">self</span>&#x000A;200: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-instance' id='method-M000021'>
+ <a name='M000021'> </a>
+ <div class='synopsis'>
+ <span class='name'>on_extended_data</span>
+ <span class='arguments'>(&amp;block)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Registers a callback on all component channels, to be invoked when the
+ remote process emits &#8220;extended&#8221; data (typically on its
+ <tt>stderr</tt> stream). The block will be invoked with three arguments:
+ the specific channel object, an integer describing the data type (usually a
+ 1 for <tt>stderr</tt>) and the data that was received.
+ </p>
+ <pre>channel.on_extended_data do |ch, type, data|&#x000A; puts &quot;got extended data: #{data}&quot;&#x000A;end</pre>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000021-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000021-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 161</span>&#x000A;161: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">on_extended_data</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A;162: <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_extended_data</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) }&#x000A;163: <span class="ruby-keyword kw">self</span>&#x000A;164: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-instance' id='method-M000025'>
+ <a name='M000025'> </a>
+ <div class='synopsis'>
+ <span class='name'>on_open_failed</span>
+ <span class='arguments'>(&amp;block)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Registers a callback on all component channels, to be invoked when the
+ remote server is unable to open the channel. The callback will be invoked
+ with three arguments: the channel object that couldn&#8217;t be opened, a
+ description of the error (as a string), and an integer code representing
+ the error.
+ </p>
+ <pre>channel.on_open_failed do |ch, description, code|&#x000A; # ...&#x000A;end</pre>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000025-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000025-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 211</span>&#x000A;211: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">on_open_failed</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A;212: <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_open_failed</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) }&#x000A;213: <span class="ruby-keyword kw">self</span>&#x000A;214: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-instance' id='method-M000022'>
+ <a name='M000022'> </a>
+ <div class='synopsis'>
+ <span class='name'>on_process</span>
+ <span class='arguments'>(&amp;block)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Registers a callback on all component channels, to be invoked during the
+ idle portion of the connection event loop. The callback will be invoked
+ with one argument: the specific channel object being processed.
+ </p>
+ <pre>channel.on_process do |ch|&#x000A; # ...&#x000A;end</pre>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000022-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000022-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 173</span>&#x000A;173: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">on_process</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A;174: <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_process</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) }&#x000A;175: <span class="ruby-keyword kw">self</span>&#x000A;176: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-instance' id='method-M000026'>
+ <a name='M000026'> </a>
+ <div class='synopsis'>
+ <span class='name'>on_request</span>
+ <span class='arguments'>(type, &amp;block)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Registers a callback on all component channels, to be invoked when the
+ remote server sends a channel request of the given <tt>type</tt>. The
+ callback will be invoked with two arguments: the specific channel object
+ receiving the request, and a Net::SSH::Buffer instance containing the
+ request-specific data.
+ </p>
+ <pre>channel.on_request(&quot;exit-status&quot;) do |ch, data|&#x000A; puts &quot;exited with #{data.read_long}&quot;&#x000A;end</pre>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000026-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000026-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 225</span>&#x000A;225: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">on_request</span>(<span class="ruby-identifier">type</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A;226: <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">on_request</span>(<span class="ruby-identifier">type</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) }&#x000A;227: <span class="ruby-keyword kw">self</span>&#x000A;228: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-instance' id='method-M000014'>
+ <a name='M000014'> </a>
+ <div class='synopsis'>
+ <span class='name'>request_pty</span>
+ <span class='arguments'>(opts={}, &amp;block)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Perform a <tt><a href="Channel.html#M000014">request_pty</a></tt> command
+ on all component channels. The block, if given, is passed to each component
+ channel, so it will (potentially) be invoked once for every channel in the
+ collection. The block will receive two parameters: the specific channel
+ object being operated on, and a boolean indicating whether the pty request
+ succeeded or not.
+ </p>
+ <pre>channel.request_pty do |ch, success|&#x000A; # ...&#x000A;end</pre>
+ <p>
+ See the documentation in <a href="../../SSH.html">Net::SSH</a> for
+ Net::SSH::Connection::Channel#request_pty for more information on how to
+ work with the callback.
+ </p>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000014-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000014-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 95</span>&#x000A;95: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">request_pty</span>(<span class="ruby-identifier">opts</span>={}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)&#x000A;96: <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">request_pty</span>(<span class="ruby-identifier">opts</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) }&#x000A;97: <span class="ruby-keyword kw">self</span>&#x000A;98: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-instance' id='method-M000015'>
+ <a name='M000015'> </a>
+ <div class='synopsis'>
+ <span class='name'>send_data</span>
+ <span class='arguments'>(data)</span>
+ </div>
+ <div class='description'>
+ <p>
+ Send the given <tt>data</tt> to each component channel. It will be sent to
+ the remote process, typically being received on the process&#8217;
+ <tt>stdin</tt> stream.
+ </p>
+ <pre>channel.send_data &quot;password\n&quot;</pre>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000015-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000015-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 104</span>&#x000A;104: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_data</span>(<span class="ruby-identifier">data</span>)&#x000A;105: <span class="ruby-identifier">channels</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">channel</span><span class="ruby-operator">|</span> <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">send_data</span>(<span class="ruby-identifier">data</span>) }&#x000A;106: <span class="ruby-keyword kw">self</span>&#x000A;107: <span class="ruby-keyword kw">end</span></pre>
+ </div>
+ </div>
+ <div class='method public-instance' id='method-M000017'>
+ <a name='M000017'> </a>
+ <div class='synopsis'>
+ <span class='name'>wait</span>
+ <span class='arguments'>()</span>
+ </div>
+ <div class='description'>
+ <p>
+ Runs the connection&#8217;s event loop until the channel is no longer
+ active (see <a href="Channel.html#M000016">active?</a>).
+ </p>
+ <pre>channel.exec &quot;something&quot;&#x000A;channel.wait</pre>
+ </div>
+ <div class='source'>
+ <a class='source-toggle' href='#' onclick="toggleCode('M000017-source'); return false">
+ [show source]
+ </a>
+ <pre id='M000017-source'> <span class="ruby-comment cmt"># File lib/net/ssh/multi/channel.rb, line 121</span>&#x000A;121: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">wait</span>&#x000A;122: <span class="ruby-identifier">connection</span>.<span class="ruby-identifier">loop</span> { <span class="ruby-identifier">active?</span> }&#x000A;123: <span class="ruby-keyword kw">self</span>&#x000A;124: <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>