summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ext/pty/lib/expect.rb6
2 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 9ac11cce81..73c25d4c0f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Apr 9 23:57:35 2010 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * ext/pty/lib/expect.rb: add rdoc. based on a patch from Luiz Angelo
+ Daros de Luca in [ruby-core:23464].
+
Fri Apr 9 23:54:16 2010 Yusuke Endoh <mame@tsg.ne.jp>
* lib/irb/init.rb, lib/irb/lc/help-message,
diff --git a/ext/pty/lib/expect.rb b/ext/pty/lib/expect.rb
index 08191b05b9..50d2fbd363 100644
--- a/ext/pty/lib/expect.rb
+++ b/ext/pty/lib/expect.rb
@@ -1,6 +1,12 @@
$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.
def expect(pat,timeout=9999999)
buf = ''
case pat