Class: Async::Wrapper Deprecated

Inherits:
Object
  • Object
show all
Defined in:
lib/async/wrapper.rb

Overview

Deprecated.

With no replacement. Prefer native interfaces.

Represents an asynchronous IO within a reactor.

Defined Under Namespace

Classes: Cancelled

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io, reactor = nil) ⇒ Wrapper

Returns a new instance of Wrapper.



33
34
35
36
37
38
# File 'lib/async/wrapper.rb', line 33

def initialize(io, reactor = nil)
	@io = io
	@reactor = reactor
	
	@timeout = nil
end

Instance Attribute Details

#ioObject (readonly)

The underlying native ‘io`.



47
48
49
# File 'lib/async/wrapper.rb', line 47

def io
  @io
end

#reactorObject

Returns the value of attribute reactor.



40
41
42
# File 'lib/async/wrapper.rb', line 40

def reactor
  @reactor
end

Instance Method Details

#closeObject

Close the io and monitor.



71
72
73
# File 'lib/async/wrapper.rb', line 71

def close
	@io.close
end

#closed?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/async/wrapper.rb', line 75

def closed?
	@io.closed?
end

#dupObject



42
43
44
# File 'lib/async/wrapper.rb', line 42

def dup
	self.class.new(@io.dup)
end

#wait_any(timeout = @timeout) ⇒ Object

Wait fo the io to become either readable or writable.



66
67
68
# File 'lib/async/wrapper.rb', line 66

def wait_any(timeout = @timeout)
	@io.wait_any(timeout) or raise TimeoutError
end

#wait_priority(timeout = @timeout) ⇒ Object

Wait for the io to become writable.



55
56
57
# File 'lib/async/wrapper.rb', line 55

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.



50
51
52
# File 'lib/async/wrapper.rb', line 50

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.



60
61
62
# File 'lib/async/wrapper.rb', line 60

def wait_writable(timeout = @timeout)
	@io.to_io.wait_writable(timeout) or raise TimeoutError
end