Class: Net::SSH::Compat::Watcher

Inherits:
IOWatcher
  • Object
show all
Defined in:
lib/pmux/mros.rb

Instance Method Summary collapse

Constructor Details

#initialize(ruby_io, flags, fiber, watchers) ⇒ Watcher

Returns a new instance of Watcher.



15
16
17
18
19
20
# File 'lib/pmux/mros.rb', line 15

def initialize ruby_io, flags, fiber, watchers
  @ruby_io = ruby_io
  @fiber = fiber
  @watchers = watchers
  super ruby_io, flags
end

Instance Method Details

#cleanupObject



30
31
32
33
34
# File 'lib/pmux/mros.rb', line 30

def cleanup
  for w in @watchers
    w.detach
  end
end

#on_readableObject



22
23
24
25
# File 'lib/pmux/mros.rb', line 22

def on_readable
  cleanup
  @fiber.resume([[@ruby_io]])
end

#on_writableObject



26
27
28
29
# File 'lib/pmux/mros.rb', line 26

def on_writable
  cleanup
  @fiber.resume([[], [@ruby_io]])
end