Svend
Svend

Reputation: 8158

Documentation how to

How do I best navigate the core docs? What are others doing when curious about what methods are available on standard classes?

This other SO question is the same, but the accepted answer isn't cutting it for me.

I was trying

f = File.open("some-file.txt","w+")

and then wanted to check what methods I have available on f after this. I tried the following:

ri File.open -> Nothing known about File.open

The core docs tells that File at least doesn't define "open". But the page doesn't mention which modules File mixes in, or inherits from. So I wrote a script:

p File.open("foo.txt", "w+").methods

But this seems quite inefficient (not to mention a raw list of methods isn't the best documentation).

Upvotes: 1

Views: 1491

Answers (6)

pierrotlefou
pierrotlefou

Reputation: 40811

I found Fxri is useful when you want to browse what method is avaiable for certain object. It is default in Ruby windows install package.

https://rubygems.org/gems/fxri/

Upvotes: 0

wombleton
wombleton

Reputation: 8376

I used pickaxe. It wasn't the be all and end all, but it was pretty decent.

Now I guess it would have to be http://ruby-doc.org

Upvotes: 3

peku
peku

Reputation: 5103

I use http://apidock.com/ruby for Ruby documentation and the site also features Rails and RSpec documentation.

Upvotes: 0

Matt Grande
Matt Grande

Reputation: 12157

Honestly, I usually just go to google and enter "Ruby [method name]" and what I want is almost always in the top three results. If it's not, I fall back to rubybrain.

Upvotes: 0

Chuck
Chuck

Reputation: 237110

You can just do ri File and it will give you full info on the File class (including the methods it implements and its superclass) or ri open (which will tell you all the places open is implemented if there are several).

Upvotes: 1

ennuikiller
ennuikiller

Reputation: 46985

You can access the documentation on your system from a browser. This details how to set it up.

Upvotes: 0

Related Questions