Class: NIO::Monitor
- Inherits:
-
Object
- Object
- NIO::Monitor
- Defined in:
- lib/nio/monitor.rb,
lib/nio/jruby/monitor.rb,
ext/nio4r/monitor.c,
ext/nio4r/selector.c
Overview
Monitors watch Channels for specific events
Instance Attribute Summary collapse
-
#interests ⇒ Object
readonly
Obtain the interests for this monitor.
-
#io ⇒ Object
Returns the value of attribute io.
-
#readiness ⇒ Object
What is the IO object ready for?.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#close ⇒ Object
Deactivate this monitor.
-
#closed? ⇒ Boolean
Is this monitor closed?.
-
#initialize(io, selection_key) ⇒ Object
constructor
Methods.
-
#readable? ⇒ Boolean
Is the IO object readable?.
-
#writable? ⇒ Boolean
(also: #writeable?)
Is the IO object writable?.
Constructor Details
#initialize(io, selection_key) ⇒ Object
Methods
8 9 10 11 |
# File 'lib/nio/monitor.rb', line 8 def initialize(io, interests) @io, @interests = io, interests @closed = false end |
Instance Attribute Details
#interests ⇒ Object (readonly)
Obtain the interests for this monitor
14 15 16 |
# File 'lib/nio/jruby/monitor.rb', line 14 def interests @interests end |
#io ⇒ Object
Returns the value of attribute io.
21 22 23 |
# File 'ext/nio4r/monitor.c', line 21 def io @io end |
#readiness ⇒ Object
What is the IO object ready for?
19 20 21 |
# File 'lib/nio/jruby/monitor.rb', line 19 def readiness @readiness end |
#value ⇒ Object
Returns the value of attribute value.
25 26 27 |
# File 'ext/nio4r/monitor.c', line 25 def value @value end |
Instance Method Details
#close ⇒ Object
Deactivate this monitor
28 29 30 |
# File 'lib/nio/monitor.rb', line 28 def close @closed = true end |
#closed? ⇒ Boolean
Is this monitor closed?
25 |
# File 'lib/nio/monitor.rb', line 25 def closed?; @closed; end |
#readable? ⇒ Boolean
Is the IO object readable?
14 15 16 |
# File 'lib/nio/monitor.rb', line 14 def readable? readiness == :r || readiness == :rw end |
#writable? ⇒ Boolean Also known as: writeable?
Is the IO object writable?
19 20 21 |
# File 'lib/nio/monitor.rb', line 19 def writable? readiness == :w || readiness == :rw end |