class Net::SSH::Connection::Channel
Attributes
defer[R]
Public Class Methods
new(connection, *args, &block)
click to toggle source
# File lib/evented-ssh/connection/channel.rb, line 7 def initialize(connection, *args, &block) original_initialize(connection, *args, &block) @defer = connection.transport.reactor.defer # Cleanup channel when it closes @defer.promise.finally { process } end
Also aliased as: original_initialize
Public Instance Methods
close()
click to toggle source
# File lib/evented-ssh/connection/channel.rb, line 44 def close return if @closing @closing = true # Actively attempt to close the channel @connection.transport.reactor.next_tick do process end end
do_close()
click to toggle source
# File lib/evented-ssh/connection/channel.rb, line 32 def do_close # Resolve the promise and anything waiting @defer.resolve(nil) original_do_close end
Also aliased as: original_do_close
promise()
click to toggle source
Allow direct access to the promise. Means we can do parallel tasks and then grab the results of multiple executions.
# File lib/evented-ssh/connection/channel.rb, line 27 def promise @defer.promise end
send_data(data)
click to toggle source
# File lib/evented-ssh/connection/channel.rb, line 39 def send_data(data) original_send_data(data) process end
Also aliased as: original_send_data
wait()
click to toggle source
Use promise resolution instead of a loop
# File lib/evented-ssh/connection/channel.rb, line 20 def wait @defer.promise.value end