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.
10 11 12 13 |
# File 'lib/riser/poll.rb', line 10 def initialize(read_io) @read_io = read_io reset_timer end |
Instance Method Details
#interval_seconds ⇒ Object
20 21 22 |
# File 'lib/riser/poll.rb', line 20 def interval_seconds Time.now - @t0 end |
#read_poll(timeout_seconds) ⇒ Object Also known as: poll, call
24 25 26 27 28 |
# File 'lib/riser/poll.rb', line 24 def read_poll(timeout_seconds) readable = @read_io.wait_readable(timeout_seconds) reset_timer unless readable.nil? readable end |
#reset_timer ⇒ Object
15 16 17 18 |
# File 'lib/riser/poll.rb', line 15 def reset_timer @t0 = Time.now self end |