2

Simple question, what is the best way on windows to search the documentation. This time I was wanting information on 'while'(resolved now by google) but I still can't can't get ri or the chm documentation on windows to give a result to while.

If I type in the Keyword in search in the chm it doesn't return 'while' it returns many results but not 'while' same for index search.

so In installed ri.

>rdoc --all --ri

but if I search while

C:\Ruby193\bin>ri 'while'
Nothing known about .while

I would like to read from the official results. Whats the best?

Also tried ri interactive but same result.

C:\Documents and Settings\renshaw>ri -i

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

>> while
Nothing known about .while
>>
Chains
  • 12,541
  • 8
  • 45
  • 62
sayth
  • 6,696
  • 12
  • 58
  • 100
  • well, I use the ruby docs extension for chrome but that's a different approach to the problem... – three Feb 05 '12 at 10:36
  • i bet there is some addon for ff as well. – three Feb 05 '12 at 11:41
  • ff has a rails extension for firebug but nothing yet for ri or rdoc – sayth Feb 05 '12 at 11:42
  • after some searching you can add rdoc as a search engine in firefox http://ruby-doc.org/docbar/ – sayth Feb 06 '12 at 08:06
  • To the users who voted to close this question, if you had bothered to read it, you would understand that it is not "asking us to recommend or find a book, tool, software library, tutorial or other off-site resource." It's asking how to get the `ri` tool to display documentation on core Ruby methods. Also, what's the point in closing a question four years after it's already been answered? Don't you guys have anything better to do?! – Steve May 03 '18 at 11:48

2 Answers2

4

That's because ri gives you information about methods, and not language syntax. while is Ruby's keyword, just like begin. If you try you won't find anything about begin in ri. Instead you can try ri File::read for example.

Yax
  • 436
  • 3
  • 12
  • so how do I search then for 'while' 'if' 'push' 'pop' etc. in Ruby if ri doesn't assist. – sayth Feb 05 '12 at 12:23
  • 1
    `while` and `if` aren't methods. Grab the Pickaxe[1] to learn about syntax. Push and pop are Array's methods, so try `ri "Array::push"`. [1] - http://ruby-doc.org/docs/ProgrammingRuby/ – Yax Feb 05 '12 at 12:37
  • For online documentation I recommend http://apidock.com/ruby and http://ruby-doc.org/ – Yax Feb 05 '12 at 12:39
  • I really like apidock very nice. I ended up finding while in rdoc need to search under keywords in rdoc, would be good if ri could search keywords. Here it was http://ruby-doc.org/docs/keywords/1.9/ – sayth Feb 06 '12 at 07:58
0

For Ruby core language keywords and topics, use the ruby: prefix.

If you ran ri ruby:while, you would get a list of pages. In that list is syntax/control_expressions.rdoc, which probably contains the information that you want.

ri ruby:control_expressions

Gives you the documentation for core Ruby control expressions (which includes while).

Steve
  • 6,618
  • 3
  • 44
  • 42