jjthrash / pobox.com writes:

> Is there a way to alias a class method for a class variable's
> method?  I'd like to make an instance's methods shortcuts to its
> data's methods, as follows:
> 
> class bob
>    def initialize
>       @data = []
> 
>       alias :[] :@data.[]
>       alias :push :@data.push
> 
>       #etc.
>    end
> end
> 
> The above doesn't work.  Is there a sensible way to do this?

Perhaps the delegation library does what you want. Have a look at

   http://www.rubycentral.com/book/lib_patterns.html


Regards


Dave