From: David Alan Black Date: 2004-05-03T20:59:09+09:00 Subject: Re: The code I forgot to include Hi -- Jean-Hugues ROBERT writes: > Hi, > > Thanks to reading your code I learned that new syntax to create an array: > x = Array[1,2,3]. > So far I used to do: > x = [1,2,3] > > But using Array.[]() is cool if I want to create a subclass of Array. > > So I tried: > class MyArray < Array > def self.[](*a); super[*a] end > end > x = MyArray[1,2,3] # => NoMethodError: super: no superclass method '[]' I get a different error message (wrong # of arguments) -- but in any case, keep in mind that when you call "super", you're already calling Array.[] -- so if you add [*a] to that call, you're doing: Array[1,2,3][1,2,3] If you just use "super" by itself it will automatically propagate all the arguments up to the super method. David -- David A. Black dblack@wobblini.net