# IO.expect: where can I find documentation?

**URL:** <https://www.ruby-forum.com/t/io-expect-where-can-i-find-documentation/121454>\
**Category:** Ruby\
**Created:** [November 28, 2007, 4:31am UTC](https://www.ruby-forum.com/t/io-expect-where-can-i-find-documentation/121454 "2007-11-28T04:31:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![thechak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/aeb1de/32.png) [@thechak](https://www.ruby-forum.com/u/thechak)\
**Post date:** [November 28, 2007, 4:31am UTC](https://www.ruby-forum.com/t/io-expect-where-can-i-find-documentation/121454/1 "2007-11-28T04:31:18Z")

</div>

Hey all –

Can anyone point me to the documentation (or the source!) that defines  
the IO.expect method (parameters, return values, etc.)?  
I can’t seem to find it anywhere.

Also, I’m interested in extending this routine to use Floats (not just  
Fixnums) as timeout values (for a granularity of, say, 50  
milliseconds).

Thanks,  
– Dan C.

---

<div class="post-metadata">

**Author:** ![thechak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/aeb1de/32.png) [@thechak](https://www.ruby-forum.com/u/thechak)\
**Post date:** [November 28, 2007, 8:20am UTC](https://www.ruby-forum.com/t/io-expect-where-can-i-find-documentation/121454/2 "2007-11-28T08:20:49Z")

</div>

Dan C. wrote:

> Hey all –
> 
> Can anyone point me to the documentation (or the source!) that defines  
> the IO.expect method (parameters, return values, etc.)?  
> I can’t seem to find it anywhere.

I do not know about that. Could you mean REXML.expected? That is the  
closest thing I can think. [RDoc Documentation](http://ruby-doc.org/core/) should have most  
all the documentation there is.

---

<div class="post-metadata">

**Author:** ![thechak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/aeb1de/32.png) [@thechak](https://www.ruby-forum.com/u/thechak)\
**Post date:** [November 28, 2007, 8:30am UTC](https://www.ruby-forum.com/t/io-expect-where-can-i-find-documentation/121454/3 "2007-11-28T08:30:19Z")

</div>

## åŽ»å®˜æ–¹ç½‘ç«™çœ‹çœ‹

From: “Lloyd L.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Wednesday, November 28, 2007 3:20 PM  
Newsgroups: comp.lang.ruby  
To: “ruby-talk ML” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: Re: IO.expect: where can I find documentation??

---

<div class="post-metadata">

**Author:** ![thechak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/aeb1de/32.png) [@thechak](https://www.ruby-forum.com/u/thechak)\
**Post date:** [November 28, 2007, 1:14pm UTC](https://www.ruby-forum.com/t/io-expect-where-can-i-find-documentation/121454/4 "2007-11-28T13:14:55Z")

</div>

On Nov 27, 2007, at 9:30 PM, Dan C. wrote:

> Thanks,  
> – Dan C.

Dan,  
Where are you finding IO.expect ??  
My Ruby (1.8) doesn’t seem to have it. ri tells me nothing.  
Creating an IO object:  
i = IO.new 2  
( the handle for stderr )  
Then doing:  
i.methods.sort  
Returns no method expect. Are you using some library that extends the  
IO class?

---

<div class="post-metadata">

**Author:** ![thechak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/aeb1de/32.png) [@thechak](https://www.ruby-forum.com/u/thechak)\
**Post date:** [November 28, 2007, 1:40pm UTC](https://www.ruby-forum.com/t/io-expect-where-can-i-find-documentation/121454/5 "2007-11-28T13:40:47Z")

</div>

On Nov 28, 6:14 am, John J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > milliseconds).  
> > Then doing:  
> > i.methods.sort  
> > Returns no method expect. Are you using some library that extends the  
> > IO class?

It’s expect.rb from the standard library pty extension. The docs are  
in the source:

[http://svn.ruby-lang.org/repos/ruby/trunk/ext/pty/README](http://svn.ruby-lang.org/repos/ruby/trunk/ext/pty/README)  
[http://svn.ruby-lang.org/repos/ruby/trunk/ext/pty/README.expect](http://svn.ruby-lang.org/repos/ruby/trunk/ext/pty/README.expect)

Regards,  
Jordan

---

<div class="post-metadata">

**Author:** ![thechak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/aeb1de/32.png) [@thechak](https://www.ruby-forum.com/u/thechak)\
**Post date:** [November 29, 2007, 3:56am UTC](https://www.ruby-forum.com/t/io-expect-where-can-i-find-documentation/121454/6 "2007-11-29T03:56:10Z")

</div>

Thanks, Jordan!

So it looks like the timeout value is really only passed to  
IO#select. Would this imply then that Floats as well as Fixnums could  
be used?

I personally don’t see why not, but the docs clearly say only a Fixnum  
can be used as a timeout value. [shrug]

What do y’all think?

Rgds,  
– Dan

---

<div class="post-metadata">

**Author:** ![thechak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/aeb1de/32.png) [@thechak](https://www.ruby-forum.com/u/thechak)\
**Post date:** [December 1, 2007, 5:39am UTC](https://www.ruby-forum.com/t/io-expect-where-can-i-find-documentation/121454/7 "2007-12-01T05:39:38Z")

</div>

On Nov 28, 2007, at 18:55 PM, Dan C. wrote:

> So it looks like the timeout value is really only passed to  
> IO#select. Would this imply then that Floats as well as Fixnums could  
> be used?
> 
> I personally don’t see why not, but the docs clearly say only a Fixnum  
> can be used as a timeout value. [shrug]
> 
> What do y’all think?

You can pass a Float to #select.

---

<div class="post-metadata">

**Author:** ![thechak](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/aeb1de/32.png) [@thechak](https://www.ruby-forum.com/u/thechak)\
**Post date:** [November 30, 2007, 3:50am UTC](https://www.ruby-forum.com/t/io-expect-where-can-i-find-documentation/121454/8 "2007-11-30T03:50:50Z")

</div>

On Nov 28, 9:53 pm, Dan C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Rgds,  
> – Dan

Have a floatnum regex for ‘pattern’ /\d+.\d+/ ?
