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.
-
#io ⇒ Object
Returns the value of attribute io.
-
#readiness ⇒ Object
Returns the value of attribute readiness.
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.
16 17 18 19 20 21 |
# File 'lib/httpx/selector.rb', line 16 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.
14 15 16 |
# File 'lib/httpx/selector.rb', line 14 def interests @interests end |
#io ⇒ Object
Returns the value of attribute io.
14 15 16 |
# File 'lib/httpx/selector.rb', line 14 def io @io end |
#readiness ⇒ Object
Returns the value of attribute readiness.
14 15 16 |
# File 'lib/httpx/selector.rb', line 14 def readiness @readiness end |
Instance Method Details
#close(deregister = true) ⇒ Object
closes @io, deregisters from reactor (unless deregister
is false)
32 33 34 35 36 37 |
# File 'lib/httpx/selector.rb', line 32 def close(deregister = true) return if @closed @closed = true @reactor.deregister(@io) if deregister end |
#closed? ⇒ Boolean
39 40 41 |
# File 'lib/httpx/selector.rb', line 39 def closed? @closed end |
#readable? ⇒ Boolean
23 24 25 |
# File 'lib/httpx/selector.rb', line 23 def readable? READABLE.include?(@interests) end |
#to_s ⇒ Object
:nocov:
44 45 46 |
# File 'lib/httpx/selector.rb', line 44 def to_s "#<#{self.class}: #{@io}(closed:#{@closed}) #{@interests} #{object_id.to_s(16)}>" end |
#writable? ⇒ Boolean
27 28 29 |
# File 'lib/httpx/selector.rb', line 27 def writable? WRITABLE.include?(@interests) end |