From: Bob Gustafson Date: 2001-11-11T15:43:50+09:00 Subject: [ruby-talk:24860] Re: Help needed on subclassing >Its late here in Sweden (actually early, but anyway... ;-)) and I cant >find an elegant way to from class M subclass class T so that in >the subclass some (but not all) of the arguments for T.new are specified. > >Example: > T is class with T.new(a,b,c) > M.[] needs to return a subclass of T (lets call it S) so that calls > S.new(c) are translated to T.new(am,bm,c). > >Ok, you can use evals but I'd call that cheating. > >Please help me; my brain and screen are hazy! ;-) > >/Robert Why not do def T.new(a=defaulta,b=defaultb,c=defaultc) Except that you probably need to put the c first def T.new(c=defaultc, a=defaulta,b=defaultb) I haven't tried it. Late here in Chicago now too.. BobG