2 # Creates a new subclass of self, with a name "under" our own name.
5 # x = Foo::Bar.subclass('Zap'){}
6 # x.name # => Foo::Bar::Zap_1
7 # x.superclass.name # => Foo::Bar
8 def subclass(base_name, &body)
9 klass = Class.new(self)
10 class_name = "#{base_name}_#{class_count!}"
12 const_set(class_name, klass)
14 klass.instance_eval(&body)