From: Gregory Seidman Date: 2006-05-12T06:38:49+09:00 Subject: Re: final/closed classes in Ruby (was: Sharp knives and glue) On Fri, May 12, 2006 at 06:27:13AM +0900, Berger, Daniel wrote: } The 'Sharp knives and glue' thread inspired this. It's probably been } done before but here's my implementation of a final and/or closed class: } } # Make a class unsubclassable [...] } # Close a class (no method definitions or redefinitions) [...] } class Foo } def test } puts "hello" } end } close(self) # No method additions/redefinitions allowed } end [...] class Foo def test puts "hello" end freeze #this already exists and does what you want end } Regards, } Dan --Greg