Reflection API -- determining methods' origins

Discussion in 'Ruby' started by Hal E. Fulton, Aug 8, 2003.

  1. I've been thinking since yesterday about
    #methods and #instance_methods and such.

    I don't see any simple way of determining
    whether a method is inherited or mixed in
    or whatever. (Singleton methods can be
    detected, I think.)

    For example, suppose B inherits from A and
    mixes in M.

    I could do some array subtraction to take
    away the methods from A and M... but that
    ignores the possibility that they might be
    rewritten in B.

    What I'm trying for is a reliably way of
    determining the methods that are *defined
    in B* (regardless of whether they may be
    hiding methods in a parent).

    Am I overlooking something here?

    Hal
     
    Hal E. Fulton, Aug 8, 2003
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.