From: "David A. Black" Date: 2004-05-03T22:14:34+09:00 Subject: Re: The code I forgot to include Hi -- On Mon, 3 May 2004, Kristof Bastiaensen wrote: > Hi, > > On Mon, 03 May 2004 20:23:39 +0900, Jean-Hugues ROBERT wrote: > > So I tried: > > class MyArray < Array > > def self.[](*a); super[*a] end > > end > > x = MyArray[1,2,3] # => NoMethodError: super: no superclass method '[]' > > > > I don't understand what is happening because obviously Array.[]() > > exists. In fact it is the only class method defined by Array: > > Array.methods( false) # nota: false to avoid inherited methods, not in my > > Pickaxe > > MyArray.methods( false) # => ["[]"] in both cases. > > Perhaps that's because super works only as a method (not as > an object). > Try this: > > class MyArray < Array > def self.[](*a); super(*a) end > end Or just: def self.[](*a); super; end David -- David A. Black dblack@wobblini.net