Forum: Rails-core (closed, excessive spam) List per-object methods with my_methods

Posted by Sandofsky (Guest)
on 2008-05-23 10:11
(Received via mailing list)
I can't count the times I've found it useful to jump to console and
list the methods on an object. Of course, the default "methods" method
includes an extra 50 items. So I'm always typing "@object.methods -
Kernel.methods". Am I alone?

I wrote a patch that adds my_methods onto Object, which just acts as a
shortcut. I can understand if people don't think it belongs in the
core framework, but I think it's one of those small conveniences, like
Symbol#to_proc, that make Rails a pleasure.

Please provide feedback:

http://rails.lighthouseapp.com/projects/8994/ticke...
Posted by Jean-François Trân (Guest)
on 2008-05-23 11:52
(Received via mailing list)
2008/5/23 Sandofsky :
>
> I can't count the times I've found it useful to jump to console and
> list the methods on an object. Of course, the default "methods" method
> includes an extra 50 items. So I'm always typing "@object.methods -
> Kernel.methods". Am I alone?

-1.

Just pass the argument false to #methods, i.e. @object.methods(false)
Or for a class, klass.instance_methods(false)

It should work for all the *methods family : instance_methods,
private_instance_methods, protected_instance_methods,
public_instance_methods, ... and so on.

   -- Jean-François.

--
http://twitter.com/underflow_
Posted by Chad Woolley (Guest)
on 2008-05-23 18:29
(Received via mailing list)
On Fri, May 23, 2008 at 2:51 AM, Jean-François 
Trân<jftran@rubyfrance.org> wrote:
> Just pass the argument false to #methods, i.e. @object.methods(false)
> Or for a class, klass.instance_methods(false)

This doesn't work for me.  At least not for String and Hash.  Is it only 
in 1.9?
This topic is locked and can not be replied to.