RichardOnRails wrote: > Hi, > > Daniel Finnie in another tread help me define a Matrix of essentially > arbitrary dimension as a subclass of Array. He employs a "get" > method to handle a splat of the subscripts. I can't figure out where > this get method is defined. Does anyone have any idea? Code with > examples follow. > > Thanks in advance, > Richard > > class Matrix < Array > def [] *args > if (args.length == 2) && args[0].is_a?(Integer) && args[1].is_a? > (Integer) > get(*args) > else > super *args > end > end > end > > m = Matrix[ [10,20,30], [40,50,60], [70,80,90] ]; > puts m [0] [1].inspect # 20 > puts m [2] [0].inspect # 70 > puts m[1].inspect # [40, 50, 60] > There is no get method in Array. The get method comes from your original post, where you defined a get method. Daniel is just saying that under some conditions your [] method calls the original [] method, under others (the conditions you define) it calls your get method. -- RMagick: http://rmagick.rubyforge.org/ RMagick 2: http://rmagick.rubyforge.org/rmagick2.html