2
by A. Ito, 28 October, 1998
4
Expect library adds IO class a method called expect(), which
5
does similar act to tcl's expect extension.
7
The usage of the method is:
9
IO#expect(pattern,timeout=9999999)
11
where `pattern' is an instance of String or Regexp and `timeout'
12
is Fixnum, which can be omitted.
13
When the method is called without block, it waits until the
14
input which matches the pattern is obtained from the IO or the time
15
specified as the timeout passes. When the pattern is obtained from the
16
IO, the method returns an array. The first element of the array is the
17
entire string obtained from the IO until the pattern matches. The
18
following elements indicates the specific pattern which matched to the
19
anchor in the regular expression. If the method ends because of
20
timeout, it returns nil.
21
When the method is called with block, the array is passed as