Class: EventMachine::Ssh::Session
- Inherits:
-
Net::SSH::Connection::Session
- Object
- Net::SSH::Connection::Session
- EventMachine::Ssh::Session
- Includes:
- Log
- Defined in:
- lib/em-ssh/session.rb
Instance Method Summary collapse
-
#initialize(transport, options = {}) ⇒ Session
constructor
A new instance of Session.
-
#loop(wait = nil, &block) ⇒ Object
Override the default, blocking behavior of Net::SSH.
-
#process(wait = nil, &block) ⇒ Object
Override the default, blocking behavior of Net::SSH.
- #send_message(msg) ⇒ Object
Methods included from Log
#debug, #error, #fatal, #info, #log, #warn
Constructor Details
#initialize(transport, options = {}) ⇒ Session
Returns a new instance of Session.
6 7 8 9 |
# File 'lib/em-ssh/session.rb', line 6 def initialize(transport, = {}) super(transport, ) register_callbacks end |
Instance Method Details
#loop(wait = nil, &block) ⇒ Object
Override the default, blocking behavior of Net::SSH. Callers to loop will still wait, but not block the loop.
13 14 15 16 17 18 19 20 |
# File 'lib/em-ssh/session.rb', line 13 def loop(wait=nil, &block) f = Fiber.current l = proc do block.call ? EM.next_tick(&l) : f.resume end EM.next_tick(&l) return Fiber.yield end |
#process(wait = nil, &block) ⇒ Object
Override the default, blocking behavior of Net::SSH
23 24 25 |
# File 'lib/em-ssh/session.rb', line 23 def process(wait=nil, &block) return true end |
#send_message(msg) ⇒ Object
27 28 29 |
# File 'lib/em-ssh/session.rb', line 27 def (msg) transport.(msg) end |