Monitors watch IO objects for specific events
:nodoc
# File lib/nio/monitor.rb, line 8 def initialize(io, interests, selector) unless io.is_a?(IO) if IO.respond_to? :try_convert io = IO.try_convert(io) elsif io.respond_to? :to_io io = io.to_io end raise TypeError, "can't convert #{io.class} into IO" unless io.is_a? IO end @io, @interests, @selector = io, interests, selector @closed = false end
Deactivate this monitor
# File lib/nio/monitor.rb, line 38 def close(deregister = true) @closed = true @selector.deregister(io) if deregister end
Is this monitor closed?
# File lib/nio/monitor.rb, line 35 def closed?; @closed; end
Is the IO object readable?
# File lib/nio/monitor.rb, line 24 def readable? readiness == :r || readiness == :rw end
Is the IO object writable?
# File lib/nio/monitor.rb, line 29 def writable? readiness == :w || readiness == :rw end
Generated with the Darkfish Rdoc Generator 2.