34

I have just installed the RVM and I am reading The Well-Grounded Rubyist book. In the first chapter I am supposed to try ri String#upcase to view documentation on the upcase method, however I get a message saying:

Nothing known about String#upcase

I found some posts here on SO telling me that it probably is because RDoc is not installed. However I do not understand how to fix it.

I am using Mac OSX 10.6, and latest RVM. I have only installed 1.9.2, in addition to the standard Ruby interpreter which come along with the Developer kit from Apple.

LuckyLuke
  • 47,771
  • 85
  • 270
  • 434

3 Answers3

56

Did you generate the docs?

rvm docs generate

https://rvm.io/rubies/docs/

mpapis
  • 52,729
  • 14
  • 121
  • 158
Casper
  • 33,403
  • 4
  • 84
  • 79
  • 3
    Or `rvm docs generate-ri` to generate just Ri docs, without RDoc. – Ernest Jan 25 '13 at 20:14
  • What about those of us not using rvm? – Jim Hessin Jan 15 '20 at 04:08
  • @JimHessin You can look here, although it may not work on latest Ruby: https://stackoverflow.com/questions/1575373/why-does-my-ruby-ri-tool-not-return-results-in-command-prompt/6963148#6963148 – Casper Jan 15 '20 at 04:16
0

It might be that docs aren't working because you're using the latest ruby version, 2.1, in which rvm has some problems. It doesn't generate docs, thus you can't retrieve the docs with ri.

**Error: **

Your ruby version 2.1.2 is not supported, only 1.8.7, 1.9.2, 1.9.3, 2.0.0

BulletTime
  • 26
  • 2
0

RDoc is installed, I'm not sure why that particular lookup does not work. Perhaps somebody else can shed some light on that.

However, if you just need to find out about how to use particular parts of the API, you can't go wrong with a google search. All of the Rdoc documentation is available online from numerous locations.

Here's String#upcase for example: http://ruby-doc.org/core/classes/String.html#M001155

Dave A-R
  • 1,159
  • 1
  • 11
  • 22
  • 1
    [apidock](http://apidock.com/) also has some pretty good reference material on [String#upcase](http://apidock.com/ruby/String/upcase) as well as anything Rails or Ruby. – tadman Jul 08 '11 at 14:53
  • @SaucyK: I know that the API is available online, but obviously I am missing something, and I want to fix it. – LuckyLuke Jul 08 '11 at 15:41