From: Pit Capitain Date: 2006-07-14T07:46:33+09:00 Subject: Re: challenge ara.t.howard@noaa.gov schrieb: > wow. learn something every day! > > ~ > cat a.rb > class File > def File.open(*a) 42 end > end > > p File.open(__FILE__) > > class << File; self; end.class_eval do > remove_method :open > end > > p File.open(__FILE__) > > > > ~ > ruby a.rb > 42 > # > > > i wasn't aware remove_method had this 'stacklike' quality. Ara, I just called p open_m and noticed that "open" wasn't a method of class "File", but of class "IO"! So to get back to the normal behaviour it was enough to remove the new method of class "File". This is even shorter: class << File remove_method :open end The "class_eval" part isn't necessary. Regards, Pit