No documentation for File's methods?

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?

···

--
Posted via http://www.ruby-forum.com/.

Albert Schlef 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.

···

--
Posted via http://www.ruby-forum.com/\.

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.)

···

--
Posted via http://www.ruby-forum.com/.

perhaps you need to rebuild the index

fastri-server -b

···

On Thu, May 7, 2009 at 4:33 AM, Albert Schlef <albertschlef@gmail.com> 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.

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?

--
Rick DeNatale

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

Albert Schlef 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

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

···

2009/5/7 Jörg W Mittag <JoergWMittag+Usenet@googlemail.com>:

Albert Schlef 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.

------------------------------------------------------------------------
...

$ 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/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

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.)
--
Posted via http://www.ruby-forum.com/\.

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

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

···

On Fri, May 8, 2009 at 3:08 AM, Albert Schlef <albertschlef@gmail.com> wrote:

Hi, people! I'm the original poster.

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?

--
Rick DeNatale

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

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.

···

On Fri, May 8, 2009 at 7:46 AM, Rick DeNatale <rick.denatale@gmail.com> wrote:

On Fri, May 8, 2009 at 3:08 AM, Albert Schlef <albertschlef@gmail.com> wrote:

Hi, people! I'm the original poster.

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 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

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/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale