No documentation for File's methods?

A

Albert Schlef

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

Albert Schlef

Albert said:
[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::eek:pen"?

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

Albert Schlef

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

Rick DeNatale

We can do the following...

=A0 File.open('somefile.txt')

=A0 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 =3D open('|date')"). So I know that "qr= i
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

--=20
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
 
J

Jörg W Mittag

Albert said:
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
 
R

Rick DeNatale

2009/5/7 J=F6rg W Mittag said:
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]] ) =3D> io or nil
open(path [, mode [, perm]] ) {|io| block } =3D> obj
------------------------------------------------------------------------
...

$ qri File.foreach
------------------------------------------------------------ IO::foreach
IO.foreach(name, sep_string=3D$/) {|line| block } =3D> nil
------------------------------------------------------------------------
...

I suspect the OP has a corrupted fast_ri index which needs to be rebuilt.

--=20
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
 
A

Albert Schlef

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 said:
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.)
 
R

Rick DeNatale

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
=A0 =A0 IO.new(fd, mode_string) =A0 =3D> io
------------------------------------------------------------------------
=A0 =A0 Returns a new IO object (a stream) for the given integer file
=A0 =A0 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_templa=
tes-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.



--=20
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
 
R

Rick DeNatale

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_temp= lates-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.


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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top