Class: IO
- Inherits:
-
Object
- Object
- IO
- Defined in:
- lib/rubysl/io/wait/wait.rb
Instance Method Summary collapse
-
#ready? ⇒ Boolean
Return self if the IO object has data ready to read.
-
#wait(timeout = nil) ⇒ Object
Wait until IO has data to read.
Instance Method Details
#ready? ⇒ Boolean
Return self if the IO object has data ready to read.
3 4 5 6 |
# File 'lib/rubysl/io/wait/wait.rb', line 3 def ready? return false if closed? return self if IO.select([self], nil, nil, 0) end |
#wait(timeout = nil) ⇒ Object
Wait until IO has data to read.
timeout
specifies how long to wait for data.
11 12 13 14 |
# File 'lib/rubysl/io/wait/wait.rb', line 11 def wait(timeout=nil) return false if closed? return self if IO.select([self], nil, nil, timeout) end |