From: "ara.t.howard" Date: 2008-11-15T01:19:08+09:00 Subject: Re: Class.new and class keyword not the same? On Nov 14, 2008, at 9:09 AM, Trans wrote: > Here the normal scenario: > > class X > def self.inherited(s) > p "here" > end > end > > class Z < X > p "race" > end > > result: > > "here" > "race" > > But in a test case of mine I need the class to be a variable, but: > > z = Class.new(X) do > p "race" > end > > result: > > "race" > "here" > > Why is "race" coming before "here"? > > ruby 1.8.6 (2007-09-24 patchlevel 111) [x86_64-linux] > > T. > dunno why - but the fix is cfp:~ > cat a.rb class X def self.inherited(s) p "here" end end z = Class.new(X) z.class_eval do p "race" end class Z < X p "race" end cfp:~ > ruby a.rb "here" "race" "here" "race" a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama