From: Hugh Sasse Staff Elec Eng Date: 2001-11-22T20:53:00+09:00 Subject: [ruby-talk:26132] Re: Dynamic programming and Unit Testing. On Thu, 22 Nov 2001, Robert Feldt wrote: > On Thu, 22 Nov 2001, Hugh Sasse Staff Elec Eng wrote: > > Sorry for not replying to all of your mail, but at least: That's OK. > > > However, one cannot define a class in a method. This presumably relates > > > Well, you can sort of do it: > > class T > def sub > cls = Class.new(T) > cls.class_eval %{ > def sub > puts "No more! Already in subclass." > end > } > cls > end > end > > SubT = T.new.sub > st = SubT.new > st.sub #=> "No more! Already in subclass." > > Maybe you can adapt this for your problem? Or am I out of line? Hmm, this looks interesting, but feels like a workaround. I'm trying to understand the intended way of doing it. But this is worth knowing about. Thank you. > > /Robert > > Hugh