# No documentation for File's methods?

**URL:** <https://www.ruby-forum.com/t/no-documentation-for-files-methods/167384>\
**Category:** Ruby\
**Created:** [May 7, 2009, 10:33am UTC](https://www.ruby-forum.com/t/no-documentation-for-files-methods/167384 "2009-05-07T10:33:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![alby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85f322/32.png) [@alby](https://www.ruby-forum.com/u/alby)\
**Post date:** [May 7, 2009, 10:33am UTC](https://www.ruby-forum.com/t/no-documentation-for-files-methods/167384/1 "2009-05-07T10:33:22Z")

</div>

We can do the following…

File.open(‘somefile.txt’)

File.foreach(‘somefile’)

…and I’m trying to see the documentation for these class methods.

So I execute “ri File#open” and “ri File#foreach” and I get nothing.

I installed fast-ri and I execute “qri File#foreach” and, again, get  
nothing.

Interestingly, when I do “qri File#open” I get the documentation for  
“Kernel#open”. However, File#open isn’t kernel#open because the latter  
can open a subprocess (as in “cmd = open(’|date’)”). So I know that “qri  
File#open” too doesn’t give me the documentation for File#open.

So my question is:

How do I get documentaiton for the methods of class File?

---

<div class="post-metadata">

**Author:** ![alby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85f322/32.png) [@alby](https://www.ruby-forum.com/u/alby)\
**Post date:** [May 7, 2009, 10:44am UTC](https://www.ruby-forum.com/t/no-documentation-for-files-methods/167384/2 "2009-05-07T10:44:13Z")

</div>

Albert S. wrote:

> [snip]  
> So I execute “ri File#open” and “ri File#foreach” and I get nothing.

My, my, my. I used ‘#’ instead of ‘.’. My fault.

But it doesn’t change much when I fix my error:

ri “File.open” and “ri File.foreach” return nothing.

“qri File.open” returns documentation for Kernel#open, which isn’t  
correct.

“qri File.foreach” is an improvement! I get documentation for  
IO::foreach. That’s good.

But… why doesn’t “qri File.open” gives me the documentation for  
“IO::open”?

And why the heck doesn’t “qri IO.open” give me the documentation for  
“IO.open”?!

WWWwwwooooooooooooowwwww!!!

It’s like a russian roulette. You shoot in the dark hoping to get  
documentation for something, and go figure the meaning of what you get.

I’m sad.

---

<div class="post-metadata">

**Author:** ![alby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85f322/32.png) [@alby](https://www.ruby-forum.com/u/alby)\
**Post date:** [May 7, 2009, 10:46am UTC](https://www.ruby-forum.com/t/no-documentation-for-files-methods/167384/3 "2009-05-07T10:46:00Z")

</div>

I forgot to mention my software:

ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]

ri v1.0.1 - 20041108

fri 0.3.1 (2008-02-02)

(Ubuntu 9.04 system.)

---

<div class="post-metadata">

**Author:** ![alby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85f322/32.png) [@alby](https://www.ruby-forum.com/u/alby)\
**Post date:** [May 7, 2009, 5:16pm UTC](https://www.ruby-forum.com/t/no-documentation-for-files-methods/167384/4 "2009-05-07T17:16:47Z")

</div>

On Thu, May 7, 2009 at 4:33 AM, Albert S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I installed fast-ri and I execute “qri File#foreach” and, again, get  
> nothing.
> 
> Interestingly, when I do “qri File#open” I get the documentation for  
> “Kernel#open”. However, File#open isn’t kernel#open because the latter  
> can open a subprocess (as in “cmd = open(‘|date’)”). So I know that “qri  
> File#open” too doesn’t give me the documentation for File#open.
> 
> So my question is:
> 
> How do I get documentaiton for the methods of class File?

perhaps you need to rebuild the index

fastri-server -b

–  
Rick DeNatale

Blog: [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)  
Twitter: [http://twitter.com/RickDeNatale](http://twitter.com/RickDeNatale)  
WWR: [http://www.workingwithrails.com/person/9021-rick-denatale](http://www.workingwithrails.com/person/9021-rick-denatale)  
LinkedIn: [http://www.linkedin.com/in/rickdenatale](http://www.linkedin.com/in/rickdenatale)

---

<div class="post-metadata">

**Author:** ![alby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85f322/32.png) [@alby](https://www.ruby-forum.com/u/alby)\
**Post date:** [May 7, 2009, 6:16pm UTC](https://www.ruby-forum.com/t/no-documentation-for-files-methods/167384/5 "2009-05-07T18:16:00Z")

</div>

Albert S. wrote:

> We can do the following…
> 
> File.open(‘somefile.txt’)
> 
> File.foreach(‘somefile’)
> 
> …and I’m trying to see the documentation for these class methods.
> 
> So I execute “ri File#open” and “ri File#foreach” and I get nothing.

Wrong class: they are defined in IO, File just inherits them.

jwm

---

<div class="post-metadata">

**Author:** ![alby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85f322/32.png) [@alby](https://www.ruby-forum.com/u/alby)\
**Post date:** [May 7, 2009, 7:09pm UTC](https://www.ruby-forum.com/t/no-documentation-for-files-methods/167384/6 "2009-05-07T19:09:58Z")

</div>

2009/5/7 Jörg W Mittag [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Wrong class: they are defined in IO, File just inherits them.

## True, but fri/qri finds inherited methods: $ qri File.open ------------------------------------------------------------ Kernel#open open(path [, mode [, perm]] ) =\> io or nil open(path [, mode [, perm]] ) {|io| block } =\> obj

…

## $ qri File.foreach ------------------------------------------------------------ IO::foreach IO.foreach(name, sep\_string=$/) {|line| block } =\> nil

…

I suspect the OP has a corrupted fast\_ri index which needs to be  
rebuilt.

–  
Rick DeNatale

Blog: [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)  
Twitter: [http://twitter.com/RickDeNatale](http://twitter.com/RickDeNatale)  
WWR: [http://www.workingwithrails.com/person/9021-rick-denatale](http://www.workingwithrails.com/person/9021-rick-denatale)  
LinkedIn: [http://www.linkedin.com/in/rickdenatale](http://www.linkedin.com/in/rickdenatale)

---

<div class="post-metadata">

**Author:** ![alby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85f322/32.png) [@alby](https://www.ruby-forum.com/u/alby)\
**Post date:** [May 8, 2009, 9:08am UTC](https://www.ruby-forum.com/t/no-documentation-for-files-methods/167384/7 "2009-05-08T09:08:00Z")

</div>

Hi, people! I’m the original poster.

I discovered an error on my part: I should have used ‘::’ instead of  
‘.’. That’s because I’m looking for the class methods. However, that  
didn’t solve my problem completely:

Rick Denatale wrote:

> True, but fri/qri finds inherited methods:  
> $ qri File.open  
> […]

Now, suppose I want the documentation for File::new. What should I do?

I do the following:

## $ qri File::new ---------------------------------------------------------------- IO::new IO.new(fd, mode\_string) =\> io

```
 Returns a new IO object (a stream) for the given integer file
 descriptor and mode string. See also IO#fileno and IO::for_fd.

```

That’s wrong. I get documentation for IO::new that involves some numeric  
‘fd’ parameter.

How do I get the documentation for File::new?

(I did rebuilt fast\_ri’s index.)

---

<div class="post-metadata">

**Author:** ![alby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85f322/32.png) [@alby](https://www.ruby-forum.com/u/alby)\
**Post date:** [May 8, 2009, 1:52pm UTC](https://www.ruby-forum.com/t/no-documentation-for-files-methods/167384/8 "2009-05-08T13:52:51Z")

</div>

On Fri, May 8, 2009 at 7:46 AM, Rick DeNatale [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > ```
> > IO.new(fd, mode_string) => io
> > 
> > ```
> 
> I don’t know. The problem might be that fastri is behind and recent  
> changes to rdoc have led to incompatibilities. See the comments here  
> [http://blog.segment7.net/articles/2009/01/28/rdoc-rdoc\_chm-rdoc\_html\_templates-2-3-0-released](http://blog.segment7.net/articles/2009/01/28/rdoc-rdoc_chm-rdoc_html_templates-2-3-0-released)
> 
> I fear that Mauricio has lost interest in his Ruby stuff and appears  
> to have moved off to other shiny objects.

It looks like the solution is to go back to using ri rather than  
fri/qri, sigh. The ri command now uses a cache so that after the  
first time, it’s faster than it used to be.

–  
Rick DeNatale

Blog: [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)  
Twitter: [http://twitter.com/RickDeNatale](http://twitter.com/RickDeNatale)  
WWR: [http://www.workingwithrails.com/person/9021-rick-denatale](http://www.workingwithrails.com/person/9021-rick-denatale)  
LinkedIn: [http://www.linkedin.com/in/rickdenatale](http://www.linkedin.com/in/rickdenatale)

---

<div class="post-metadata">

**Author:** ![alby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85f322/32.png) [@alby](https://www.ruby-forum.com/u/alby)\
**Post date:** [May 8, 2009, 1:47pm UTC](https://www.ruby-forum.com/t/no-documentation-for-files-methods/167384/9 "2009-05-08T13:47:34Z")

</div>

On Fri, May 8, 2009 at 3:08 AM, Albert S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hi, people! I’m the original poster.

> That’s wrong. I get documentation for IO::new that involves some numeric  
> ‘fd’ parameter.
> 
> How do I get the documentation for File::new?

I don’t know. The problem might be that fastri is behind and recent  
changes to rdoc have led to incompatibilities. See the comments here  
[http://blog.segment7.net/articles/2009/01/28/rdoc-rdoc\_chm-rdoc\_html\_templates-2-3-0-released](http://blog.segment7.net/articles/2009/01/28/rdoc-rdoc_chm-rdoc_html_templates-2-3-0-released)

I fear that Mauricio has lost interest in his Ruby stuff and appears  
to have moved off to other shiny objects.

–  
Rick DeNatale

Blog: [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)  
Twitter: [http://twitter.com/RickDeNatale](http://twitter.com/RickDeNatale)  
WWR: [http://www.workingwithrails.com/person/9021-rick-denatale](http://www.workingwithrails.com/person/9021-rick-denatale)  
LinkedIn: [http://www.linkedin.com/in/rickdenatale](http://www.linkedin.com/in/rickdenatale)
