From: Richard Conroy Date: 2010-06-23T02:52:40+09:00 Subject: Re: Help with Ruby return types and documentation --0016e6db620e38a9f50489a216a7 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Jun 22, 2010 at 4:59 PM, Tasos Laskos wrote: > > And of course I did all those things, I'm not an imbecile and I'm also > not bashing Ruby. > > I'd really like not to use IRB just to figure out an inheritance > hierarchy or the available method/attributes of an object. > > Hi Tasos, I came from Java like yourself, so the absence of return type documentation really warped my head too, to start with. You really can't expect Ruby authors to document return types like they do in Java - a Ruby method can return anything from a method. In practice API writers are unlikely to be jerks about it - returned objects tend to have a lot of consistency. While you may not like the IRB option, in practice it is your fastest path to understanding. However you should really take a look at awesome_print: http://www.rubyinside.com/awesome_print-a-new-pretty-printer-for-your-ruby-objects-3208.html Its a Ruby gem that puts pp (pretty print) on steroids, giving you a lot of information about the objects, including its inheritance hierarchy, and the tree structure of any Collections. There isn't really a shortcut to learning Ruby libraries. Most don't play mindgames with the return types. However HTML inspection APIs like nokogiri will be returning objects that represent complex HTML structures. I remember Hpricot being much the same. Its worth taking the library through IRB (and ap) for 30 minutes or so with some test data, to get a feel for it. regards, Richard. -- http://richardconroy.blogspot.com --0016e6db620e38a9f50489a216a7--