class NIO::Monitor
Monitors watch IO objects for specific events
def close(deregister = true)
def close(deregister = true) @closed = true @selector.deregister(io) if deregister end
def closed?; @closed; end
def closed?; @closed; end
def initialize(io, interests, selector)
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
def readable?
def readable? readiness == :r || readiness == :rw end
def writable?
def writable? readiness == :w || readiness == :rw end