Class: Riser::ReadPoll
- Inherits:
-
Object
- Object
- Riser::ReadPoll
- Defined in:
- lib/riser/poll.rb
Instance Method Summary collapse
-
#initialize(read_io) ⇒ ReadPoll
constructor
A new instance of ReadPoll.
- #interval_seconds ⇒ Object
- #read_poll(timeout_seconds) ⇒ Object (also: #poll, #call)
- #reset_timer ⇒ Object
Constructor Details
#initialize(read_io) ⇒ ReadPoll
Returns a new instance of ReadPoll.
7 8 9 10 |
# File 'lib/riser/poll.rb', line 7 def initialize(read_io) @read_io = read_io reset_timer end |
Instance Method Details
#interval_seconds ⇒ Object
17 18 19 |
# File 'lib/riser/poll.rb', line 17 def interval_seconds Time.now - @t0 end |
#read_poll(timeout_seconds) ⇒ Object Also known as: poll, call
21 22 23 24 25 |
# File 'lib/riser/poll.rb', line 21 def read_poll(timeout_seconds) readable = @read_io.wait_readable(timeout_seconds) reset_timer unless readable.nil? readable end |
#reset_timer ⇒ Object
12 13 14 15 |
# File 'lib/riser/poll.rb', line 12 def reset_timer @t0 = Time.now self end |