Class: EventMachine::Ssh::Session

Inherits:
Net::SSH::Connection::Session
  • Object
show all
Includes:
Log
Defined in:
lib/em-ssh/session.rb

Instance Method Summary collapse

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, options = {})
  super(transport, options)
  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 send_message(msg)
  transport.send_message(msg)
end