On 17.12.2008 18:24, Phlip wrote:
ri only returns what the documentor felt like telling you.
Here’s my favorite wrapper on the ‘public_methods’ system:
puts (anObject.public_methods - Object.new.public_methods).sort
You do not need to construct an instance of Object - you can as well use
Now you just say ‘what? f’, and it tells you what f’s all about. It also
throws away all the stuff f inherited from Object, because you should
already know it!
Here’s an alternative version, which prints methods with the defining
class. Note that this omits methods defined at the instance level.
def what? o
o.class.ancestors.each do |cl|
p cl, cl.public_instance_methods(false).sort