module LightIO::Wrap::IOWrapper
wrapper for ruby io objects
Public Class Methods
new(*args)
click to toggle source
wrap raw ruby io objects
@param [IO, Socket] io raw ruby io object
Calls superclass method
# File lib/lightio/wrap.rb, line 28 def initialize(*args) @obj ||= super end
Protected Class Methods
included(base)
click to toggle source
# File lib/lightio/wrap.rb, line 73 def included(base) base.send :extend, ClassMethods base.send :include, Wrapper end
Protected Instance Methods
io_watcher()
click to toggle source
# File lib/lightio/wrap.rb, line 51 def io_watcher @io_watcher ||= LightIO::Watchers::IO.new(@obj) end
wait_nonblock(method, *args)
click to toggle source
wait io nonblock method
@param [Symbol] method method name, example: wait_nonblock
@param [args] args arguments pass to method
# File lib/lightio/wrap.rb, line 37 def wait_nonblock(method, *args) loop do result = __send__(method, *args, exception: false) case result when :wait_readable io_watcher.wait_readable when :wait_writable io_watcher.wait_writable else return result end end end