listrecv / gmail.com wrote:
> I use IRB to explore.  Very often I type a.methods.sort, to see what an
> object can do.  The problem is, you're hit with 100 methods from Object
> (or the superclass).
>
> I've experimented with:
> a.methods - a.class.superclass.methods
> which works well for simple things
>
> but it doesn't seem to handle cases when there are a lot of included
> modules.   Any ideas on how to see the methods defined in a.class only,
> and not in any superclass or included module?

methods has a switch:

  object.methods(false)

and

  klass.instance_methods(false)

Also, keep in mind the differences between:

  methods
  public_methods
  private_methods
  protected_methods

  instance_methods
  public_instance_methods
  private_instance_methods
  protected_instance_methods

I've made a fool of myself more than once thinking the first combined
the later three -- it does not. methods is alias of public_methods and
likewise for the instance version.

T.