Class: Net::SSH::Compat::Watcher
- Inherits:
-
IOWatcher
- Object
- IOWatcher
- Net::SSH::Compat::Watcher
- Defined in:
- lib/pmux/mros.rb
Instance Method Summary collapse
- #cleanup ⇒ Object
-
#initialize(ruby_io, flags, fiber, watchers) ⇒ Watcher
constructor
A new instance of Watcher.
- #on_readable ⇒ Object
- #on_writable ⇒ Object
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
#cleanup ⇒ Object
30 31 32 33 34 |
# File 'lib/pmux/mros.rb', line 30 def cleanup for w in @watchers w.detach end end |
#on_readable ⇒ Object
22 23 24 25 |
# File 'lib/pmux/mros.rb', line 22 def on_readable cleanup @fiber.resume([[@ruby_io]]) end |
#on_writable ⇒ Object
26 27 28 29 |
# File 'lib/pmux/mros.rb', line 26 def on_writable cleanup @fiber.resume([[], [@ruby_io]]) end |