def register(io, interest)
      unless io.is_a? OpenSSL::SSL::SSLSocket
        io = IO.try_convert(io)
      end

      @lock.synchronize do
        raise IOError, "selector is closed" if closed?

        monitor = @selectables[io]
        raise ArgumentError, "already registered as #{monitor.interests.inspect}" if monitor

        monitor = Monitor.new(io, interest, self)
        @selectables[monitor.io] = monitor

        monitor
      end
    end
def register(io, interest)
      unless io.is_a? OpenSSL::SSL::SSLSocket
        io = IO.try_convert(io)
      end

      @lock.synchronize do
        raise IOError, "selector is closed" if closed?

        monitor = @selectables[io]
        raise ArgumentError, "already registered as #{monitor.interests.inspect}" if monitor

        monitor = Monitor.new(io, interest, self)
        @selectables[monitor.io] = monitor

        monitor
      end
    end
Register interest in an IO object with the selector for the given types
 of events. Valid event types for interest are:
 * :r - is the IO readable?
 * :w - is the IO writeable?
 * :rw - is the IO either readable or writeable?