Hi Ara, Thanks for your additional info. > myA3 = MyArrayType3.new(a3) # undefined method `MyArrayType' for main:Object > ^^^^^ > > typo? ;-) Yes, indeed! I apologize for mixing up sloppy coding with my ignorant coding. IMHO, the latter is exusable, but the former is not. > perhaps something like this (un-tested)? No problem!! I'll test it :-) > class MyArrayType < Array > def initialize(*args, &block) > if Array === args.first > ary = args.shift > super > update ary > else > super > end > end > def to_s;join '; ';end > end a4 = %w[x4 y4] myA4 = MyArrayType.new(a4) # ==> undefined method `update' for ["x4", "y4"]:MyArrayType (NoMethodError) puts myA4b.to_s # wasn't reached The Thomas/Hunt book says 'update' is a method in Hash and CGI::Session, but not in Array. > again, be very careful extending/inheriting builtin classes ... Thanks. I've already experienced some of the ones you mentioned in the course of this exercise, so I feel up-to-speed on the matter. Your 'initialize' method did present me with a few things I have to ask you about, particularly whether my understanding/guess is correct: > def initialize(*args, &block) Could (must?) be invoked as MyArrayType['x','y']{|i| dostuff(i)} so that block(element) could be executed which in turn would invoke dostuff(elemement) for selected elements in the array(s) in args. > if Array === args.first My guess is that this statement is equivalent to "if 'Array' is the type of the first item in the 'args' array." That doesn't comport with "Programming Ruby", Thomas et al, 2001, page 283, which seems to indicate "element by element comparison of two arrays." But I can't see how you could intend to compare Array's elements, because I don't think Array HAS any elements when 'initialize' is invoked. > ary = args.shift Equivalent to "ary = args[0]" in this instance, since 'args' is not modified (no "!" after "shift"). > super Invokes Array#initialze with the original arguments that 'initialize' got, but I don't see what this accomplishes. > an aggregate class is often safer and less frustrating to debug... I assume you're talking about using a Module and including it into a class or classes. As before, I appreciate your tutoring. Regards, Richard --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.665 / Virus Database: 428 - Release Date: 4/22/2004