summaryrefslogtreecommitdiff
path: root/ext/pty/lib
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pty/lib')
-rw-r--r--ext/pty/lib/expect.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/pty/lib/expect.rb b/ext/pty/lib/expect.rb
index 0b238af..c15044b 100644
--- a/ext/pty/lib/expect.rb
+++ b/ext/pty/lib/expect.rb
@@ -1,12 +1,14 @@
$expect_verbose = false
class IO
- # Reads ios until pattern matches or the timeout is over. It returns
- # an array with the read buffer, followed by the matches. If a block is given,
- # the result is yielded to the block and returns nil. The optional timeout parameter defines,
- # in seconds, the total time to wait for pattern. If it is over of eof is found, it
- # returns/yields nil. However, the buffer in a timeout session is kept for the next expect call.
- # The default timeout is 9999999 seconds.
+ # Reads from the IO until pattern +pat+ matches or the +timeout+ is over.
+ # It returns an array with the read buffer, followed by the matches.
+ # If a block is given, the result is yielded to the block and returns nil.
+ #
+ # The optional timeout parameter defines, in seconds, the total time to wait
+ # for the pattern. If the timeout expires or eof is found, nil is returned
+ # or yielded. However, the buffer in a timeout session is kept for the next
+ # expect call. The default timeout is 9999999 seconds.
def expect(pat,timeout=9999999)
buf = ''
case pat