Class: HTTPX::Selector::Monitor
- Inherits:
-
Object
- Object
- HTTPX::Selector::Monitor
- Defined in:
- lib/httpx/selector.rb
Overview
I/O monitor
Instance Attribute Summary collapse
-
#interests ⇒ Object
Returns the value of attribute interests.
-
#readiness ⇒ Object
Returns the value of attribute readiness.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#close(deregister = true) ⇒ Object
closes @io, deregisters from reactor (unless
deregister
is false). - #closed? ⇒ Boolean
-
#initialize(io, interests, reactor) ⇒ Monitor
constructor
A new instance of Monitor.
- #readable? ⇒ Boolean
-
#to_s ⇒ Object
:nocov:.
- #writable? ⇒ Boolean
Constructor Details
#initialize(io, interests, reactor) ⇒ Monitor
Returns a new instance of Monitor.
10 11 12 13 14 15 |
# File 'lib/httpx/selector.rb', line 10 def initialize(io, interests, reactor) @io = io @interests = interests @reactor = reactor @closed = false end |
Instance Attribute Details
#interests ⇒ Object
Returns the value of attribute interests.
8 9 10 |
# File 'lib/httpx/selector.rb', line 8 def interests @interests end |
#readiness ⇒ Object
Returns the value of attribute readiness.
8 9 10 |
# File 'lib/httpx/selector.rb', line 8 def readiness @readiness end |
#value ⇒ Object
Returns the value of attribute value.
8 9 10 |
# File 'lib/httpx/selector.rb', line 8 def value @value end |
Instance Method Details
#close(deregister = true) ⇒ Object
closes @io, deregisters from reactor (unless deregister
is false)
26 27 28 29 30 |
# File 'lib/httpx/selector.rb', line 26 def close(deregister = true) return if @closed @closed = true @reactor.deregister(@io) if deregister end |
#closed? ⇒ Boolean
32 33 34 |
# File 'lib/httpx/selector.rb', line 32 def closed? @closed end |
#readable? ⇒ Boolean
17 18 19 |
# File 'lib/httpx/selector.rb', line 17 def readable? @interests == :rw || @interests == :r end |
#to_s ⇒ Object
:nocov:
37 38 39 |
# File 'lib/httpx/selector.rb', line 37 def to_s "#<#{self.class}: #{@io}(closed:#{@closed}) #{@interests} #{object_id.to_s(16)}>" end |
#writable? ⇒ Boolean
21 22 23 |
# File 'lib/httpx/selector.rb', line 21 def writable? @interests == :rw || @interests == :w end |