2

I'm having some trouble navigating the RDoc information at ruby-doc. Now it's probably just me, coming from the java world but am I missing something?

For instance when I want to do File IO, I look for File and find the respective page. There I see all the static methods on File. That's perfect. What I don't find here is the actual instance methods like fileInstance.read_line, I actually found those by doing a puts of fileInstance.methods

I'd like to optimize my workflow, I'm sure I'll be delving into the ruby api a lot in the coming weeks, so have I just missed something here? Where would I find an example of read_line in the api?

Thanks

npiv
  • 1,837
  • 15
  • 24
  • You might find [railsapi.com](http://railsapi.com/doc/ruby-v1.9.2/) useful. Personally I find the Ruby (and Rails) "official documentation sites" clunky. – Zabba May 02 '11 at 06:47
  • Yup! railsapi.com uses SDOC (or Searchable rDOC). rubydoc.info has the same functionality (with YARD), but railsapi.com allows you to search methods and classes at the same time. The downfall is you cannot search project's SDOC individually going back to the main page, clicking "build your custom package", and selecting the (limited) amount of libraries to search from. – RyanScottLewis May 02 '11 at 06:52

1 Answers1

6

Try http://rubydoc.info/stdlib/core/1.9.2/frames.

Also, a nice way of printing things like my_instance.methods.sort would be:

# Require the pp library...
# which just breaks long outputs into multiple lines.
require 'pp'

pp Object.new.methods.sort

Much easier on the eyes.

Other small tips:

  • We use underscores_for_methods_and_vars, not camelCase.
  • p and puts are different. See: p vs puts in Ruby

Happy coding!

Community
  • 1
  • 1
RyanScottLewis
  • 13,396
  • 16
  • 56
  • 84