David Landrith <dlandrith / mac.com> writes:

> How do I obtain a reference to a classes superclass within a class so
> that I can call superclass methods arbitrarily from the subclass?
>
> I am extending the array class, and I need to access certain methods
> in the array class (other than the one that I am currently using in
> the subclass--so that super won't work) in order to get the
> functionality that I am looking for.

ts <decoux / moulon.inra.fr> writes:

>  alias ?


Yes you must alias the original method to a different name before you
redefine it in the sublcass.

class Foo < Array
    alias_method :super_concat, :concat
    def concat(other)
        do_whatever(other)
    end
    def do_whatever(other)
        super_concat(other)
    end
end