Class: Async::Wrapper Deprecated
- Inherits:
- 
      Object
      
        - Object
- Async::Wrapper
 
- Defined in:
- lib/async/wrapper.rb
Overview
With no replacement. Prefer native interfaces.
Represents an asynchronous IO within a reactor.
Defined Under Namespace
Classes: Cancelled
Instance Attribute Summary collapse
- 
  
    
      #io  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The underlying native ‘io`. 
- 
  
    
      #reactor  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute reactor. 
Instance Method Summary collapse
- 
  
    
      #close  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Close the underlying IO. 
- 
  
    
      #closed?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Whether the underlying IO is closed. 
- 
  
    
      #dup  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Dup the underlying IO. 
- 
  
    
      #initialize(io, reactor = nil)  ⇒ Wrapper 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Wrapper. 
- 
  
    
      #wait_any(timeout = @timeout)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Wait fo the io to become either readable or writable. 
- 
  
    
      #wait_priority(timeout = @timeout)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Wait for the io to become writable. 
- 
  
    
      #wait_readable(timeout = @timeout)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Wait for the io to become readable. 
- 
  
    
      #wait_writable(timeout = @timeout)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    Wait for the io to become writable. 
Constructor Details
#initialize(io, reactor = nil) ⇒ Wrapper
Returns a new instance of Wrapper.
| 19 20 21 22 23 24 | # File 'lib/async/wrapper.rb', line 19 def initialize(io, reactor = nil) @io = io @reactor = reactor @timeout = nil end | 
Instance Attribute Details
#io ⇒ Object (readonly)
The underlying native ‘io`.
| 34 35 36 | # File 'lib/async/wrapper.rb', line 34 def io @io end | 
#reactor ⇒ Object
Returns the value of attribute reactor.
| 26 27 28 | # File 'lib/async/wrapper.rb', line 26 def reactor @reactor end | 
Instance Method Details
#close ⇒ Object
Close the underlying IO.
| 58 59 60 | # File 'lib/async/wrapper.rb', line 58 def close @io.close end | 
#closed? ⇒ Boolean
Whether the underlying IO is closed.
| 63 64 65 | # File 'lib/async/wrapper.rb', line 63 def closed? @io.closed? end | 
#dup ⇒ Object
Dup the underlying IO.
| 29 30 31 | # File 'lib/async/wrapper.rb', line 29 def dup self.class.new(@io.dup) end | 
#wait_any(timeout = @timeout) ⇒ Object
Wait fo the io to become either readable or writable.
| 53 54 55 | # File 'lib/async/wrapper.rb', line 53 def wait_any(timeout = @timeout) @io.to_io.wait(::IO::READABLE|::IO::WRITABLE|::IO::PRIORITY, timeout) or raise TimeoutError end | 
#wait_priority(timeout = @timeout) ⇒ Object
Wait for the io to become writable.
| 42 43 44 | # File 'lib/async/wrapper.rb', line 42 def wait_priority(timeout = @timeout) @io.to_io.wait_priority(timeout) or raise TimeoutError end | 
#wait_readable(timeout = @timeout) ⇒ Object
Wait for the io to become readable.
| 37 38 39 | # File 'lib/async/wrapper.rb', line 37 def wait_readable(timeout = @timeout) @io.to_io.wait_readable(timeout) or raise TimeoutError end | 
#wait_writable(timeout = @timeout) ⇒ Object
Wait for the io to become writable.
| 47 48 49 | # File 'lib/async/wrapper.rb', line 47 def wait_writable(timeout = @timeout) @io.to_io.wait_writable(timeout) or raise TimeoutError end |