ri is suddenly empty

F

Fernando Perez

Hi,

I don't understand what happened: today I wanted to look up for: ri
Array#unshift, and it had nothing:

Enter the method name you want to look up.
You can use tab to autocomplete.
Enter a blank line to exit.


I tried other classes, and now I always get this error message. How to
fix that?



Thanks
 
M

matt neuburg

Fernando Perez said:
Hi,

I don't understand what happened: today I wanted to look up for: ri
Array#unshift, and it had nothing:

Enter the method name you want to look up.
You can use tab to autocomplete.
Enter a blank line to exit.



I tried other classes, and now I always get this error message. How to
fix that?

Oooh, oooh, call on me teacher, call on me, I know I know. It's because
you've defined an alias of "ri"; it now stands for "ri -i". When "ri"
stands for "ri -i", it ignores the argument that follows. Instead, it
presents the ">>" prompt, and *now* you can type the name of what you
want to look up. So:

Big-iMac-Attack:~ mattneub$ ri -i

Enter the method name you want to look up.
You can use tab to autocomplete.
Enter a blank line to exit.
---------------------------------------------------------- Array#unshift
array.unshift(obj, ...) -> array

From Ruby 1.8
------------------------------------------------------------------------
Prepends objects to the front of array. other elements up one.

a = [ "b", "c", "d" ]
a.unshift("a") #=> ["a", "b", "c", "d"]
a.unshift(1, 2) #=> [ 1, 2, "a", "b", "c", "d"]
Big-iMac-Attack:~ mattneub$

Notice the blank line at the end (I hit Return) in order to get out of
interactive mode. m.
 
M

Michal Suchanek

2009/4/3 matt neuburg said:
Oooh, oooh, call on me teacher, call on me, I know I know. It's because
you've defined an alias of "ri"; it now stands for "ri -i". When "ri"
stands for "ri -i", it ignores the argument that follows. Instead, it
presents the ">>" prompt, and *now* you can type the name of what you
want to look up. So:

Then take it one step further: have it examine the command line, use
the arguments if any, and enter the interactive mode if none are
present ;-)

Thanks

Michal
 
R

Ryan Davis

Then take it one step further: have it examine the command line, use
the arguments if any, and enter the interactive mode if none are
present ;-)

patches welcome
 
M

matt neuburg

Ryan Davis said:
patches welcome

Actually the patch I really want is the ability to enter numbers instead
of text.
More than one method matched your request. You can refine your
search by asking for information on one of:

String#squeeze [Ruby 1.8]
String#squeeze [Ruby 1.8]
String#squeeze! [Ruby 1.8]
String#squeeze! [Ruby 1.8]
Since there is no way to distinguish the first from the second, or the
third from the fourth, I am now USCWAP. In particular, there is
absolutely no way to get ri to provide an explanation for
String#squeeze! on my machine:
-------------------------------------------------------- String#squeeze!
squeeze!(del=nil)

From Ruby 1.8
------------------------------------------------------------------------
[no description]

[Me: So show me the *other* one!]

m.
 
F

Fernando Perez

Oooh, oooh, call on me teacher, call on me, I know I know. It's because
you've defined an alias of "ri"; it now stands for "ri -i".

nice catch! But I didn't directly create an alias for ri, instead I
created the following in my ~/.bash_profile:

export RI="--format=ansi --no-pager --interactive"


Is there any work around?
 
E

Eric Hodel

Ryan Davis said:
patches welcome

Actually the patch I really want is the ability to enter numbers
instead
of text.
More than one method matched your request. You can refine your
search by asking for information on one of:

String#squeeze [Ruby 1.8]
String#squeeze [Ruby 1.8]
String#squeeze! [Ruby 1.8]
String#squeeze! [Ruby 1.8]

Somehow you managed to install ri data twice. Try this:

find / -name "*squeeze-i.yaml"

Then delete one of the paths.

Please respond with the output of the find command so I can try to fix
this from RDoc.
 
E

Eric Hodel

Eric Hodel said:
On Apr 3, 2009, at 11:06 , Michal Suchanek wrote:

Then take it one step further: have it examine the command line,
use
the arguments if any, and enter the interactive mode if none are
present ;-)

patches welcome

Actually the patch I really want is the ability to enter numbers
instead
of text.

squeeze
More than one method matched your request. You can refine your
search by asking for information on one of:

String#squeeze [Ruby 1.8]
String#squeeze [Ruby 1.8]
String#squeeze! [Ruby 1.8]
String#squeeze! [Ruby 1.8]

Somehow you managed to install ri data twice.

No, I don't think so. I mean, yes, I did, but I deleted the second set
of data some time ago (at your suggestion). But, this is different.
Look, you can see right on this Web page that there are two squeeze!
entries:

http://ruby-doc.org/core/classes/String.html

That webpage is not built with a stock RDoc template. RDoc HTML
output and ri output are not the same.
There are two squeeze entries and two squeeze! entries. Just like on
my
machine. So it isn't just me, it's everybody.

It's not me:

apple ruby 1.8.6 with RDoc 2.4.3:

$ ri String#squeeze
Updating ri class cache with 4563 classes...
--------------------------------------------------------- String#squeeze
str.squeeze([other_str]*) => new_str

From Ruby 1.8
------------------------------------------------------------------------
Builds a set of characters from the other_str parameter(s) using
[...]

Ruby 1.8.8dev built today with RDoc 1.0.1:

$ ri18 String#squeeze
--------------------------------------------------------- String#squeeze
str.squeeze([other_str]*) => new_str
------------------------------------------------------------------------
Builds a set of characters from the other_str parameter(s) using
[...]

Ruby 1.9.1 with RDoc 2.4.2:

$ ri19 String#squeeze
Updating ri class cache with 1688 classes...
--------------------------------------------------------- String#squeeze
str.squeeze([other_str]*) => new_str

From Ruby 1.9.1
------------------------------------------------------------------------
Builds a set of characters from the other_str parameter(s) using
[...]

So I don't believe this happens with a stock ruby or with a modern RDoc.
I don't know why, and I
don't care why; I'm just saying that since this kind of thing can and
does happen, it would be cool if ri would give me a way to choose
between them. m.

I can't fix this bug without your help. You'll have to do some
investigation to find out what the problem is so I can reproduce and
fix it.
 
R

Ryan Davis

Big-iMac-Attack:~ mattneub$ ri --list-doc-dirs
/usr/local/share/ri/1.8/system
/usr/local/lib/ruby/gems/1.8/doc/builder-2.1.2/ri
/usr/local/lib/ruby/gems/1.8/doc/columnize-0.2/ri
/usr/local/lib/ruby/gems/1.8/doc/fastri-0.3.1.1/ri
/usr/local/lib/ruby/gems/1.8/doc/hpricot-0.6.164/ri
/usr/local/lib/ruby/gems/1.8/doc/linecache-0.43/ri
/usr/local/lib/ruby/gems/1.8/doc/rake-0.8.3/ri
/usr/local/lib/ruby/gems/1.8/doc/rdoc-2.2.1/ri
/usr/local/lib/ruby/gems/1.8/doc/rubygems-1.3.1/ri
/usr/local/lib/ruby/gems/1.8/doc/rubytree-0.5.2/ri

find `ri --list-doc-dirs` -name \*squeeze-i.yaml

pls
 
M

matt neuburg

Ryan Davis said:
find `ri --list-doc-dirs` -name \*squeeze-i.yaml

pls

/usr/local/share/ri/1.8/system/String/squeeze-i.yaml

m.

PS Your shell line didn't work OMM so I wrote a version in a language I
understand a little better, i.e. Ruby:

`ri --list-doc-dirs`.each {
|s| puts `find '#{s.chomp}' -name '*squeeze-i.yaml'`
}

PPS I would just like to repeat that I don't actually care about this
particular problem. Even without the peculiar case of squeeze!, I would
*still* like interactive ri to present me with a list of numbers to type
instead of names. One or two characters (digits) is a much faster
alternative for picking the one you want.
 
R

Ryan Davis

PPS I would just like to repeat that I don't actually care about this
particular problem. Even without the peculiar case of squeeze!, I
would
*still* like interactive ri to present me with a list of numbers to
type
instead of names. One or two characters (digits) is a much faster
alternative for picking the one you want.

So write a patch. We don't really care what you really care about or
not. We need a repro for this problem and we have yet to have anyone
give us one.
 
R

Ryan Davis

Big-iMac-Attack:~ mattneub$ ri --list-doc-dirs
/usr/local/share/ri/1.8/system
/usr/local/lib/ruby/gems/1.8/doc/builder-2.1.2/ri
/usr/local/lib/ruby/gems/1.8/doc/columnize-0.2/ri
/usr/local/lib/ruby/gems/1.8/doc/fastri-0.3.1.1/ri
/usr/local/lib/ruby/gems/1.8/doc/hpricot-0.6.164/ri
/usr/local/lib/ruby/gems/1.8/doc/linecache-0.43/ri
/usr/local/lib/ruby/gems/1.8/doc/rake-0.8.3/ri
/usr/local/lib/ruby/gems/1.8/doc/rdoc-2.2.1/ri
/usr/local/lib/ruby/gems/1.8/doc/rubygems-1.3.1/ri
/usr/local/lib/ruby/gems/1.8/doc/rubytree-0.5.2/ri

I don't have those in my gauntlet setup. I've got:

builder-2.1.2.tgz
columnize-0.3.0.tgz
fastri-0.3.1.1.tgz
hpricot-0.7.tgz
linecache-0.43.tgz
rake-0.8.4.tgz
rdoc-2.4.1.tgz
rubytree-0.5.2.tgz

+ rubygems via svn. I've grepped through all of them and none of them
define a squeeze method. So I'm still without a repro. The code I used
is below and I dry ran it with def.+initialize to ensure I was doing
it right:
gs = %w(builder columnize fastri hpricot linecache rake rdoc
rubygems rubytree)

Dir.chdir File.expand_path("~/.gauntlet") do
gs.each do |gem|
hits = Dir["#{gem}-[0-9]*tgz"].reject {|s| s =~ /ms/}
hits.each do |hit|
puts hit
system "zegrep -a def.+squeeze #{hit}"
end
end
end
 

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

Forum statistics

Threads
473,776
Messages
2,569,602
Members
45,185
Latest member
GluceaReviews

Latest Threads

Top