lib/defined-by/define_class.rb in defined-by-0.0.5 vs lib/defined-by/define_class.rb in defined-by-0.0.6

- old
+ new

@@ -1,7 +1,9 @@ def define_class(name, superclass = Object, &block) name = name.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } + superclass = superclass.to_s.gsub(/^:*/, "::") eval("class #{name} < #{superclass}; end") clazz = eval(name) + clazz.unloadable if clazz.respond_to?(:unloadable) clazz.class_eval(&block) if block_given? clazz end