This question already has an answer here:
Is there a way to find out which part of my ri
command that is not showing Ruby's documentation:
$ ruby --version
ruby 1.9.3p392 (2013-02-22 revision 39386) [i686-linux]
$ ri --version
ri 3.12.2
$ ri String
Nothing known about String
When I use pry:
$ pry --version
Pry version 0.9.12 on Ruby 1.9.3
$ pry
[1] pry(main)> ri String
# shows String documentation
[2] pry(main)> ri String.split
error: 'String.split' not found
[3] pry(main)> ri String.strip
String.strip not found, maybe you meant:
String#strip_heredoc
What should I do to make the documentation appear?
Well, there are no methods
String.split
orString.strip
. There are, however, methodsString#split
andString#strip
. Try asking for those, and you'll probably get their documentation.If you're using
RVM
to manage your Ruby installations you can do this:If not, try doing this:
then try the
ri
command again.You mentioned in a comment that you're using the Ruby package from archlinux's package manager. What you need for
ri
is to install theruby-docs
package:I guess they separate the packages so people who don't want the docs can save on disk usage.
With pry, it's better to install the
pry-doc
gem, and then use theshow-doc
command:Note: you can also use the
?
alias forshow-doc
if you prefer.