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

- old
+ new

@@ -4,8 +4,19 @@ parts.each_with_index do |part, index| sub_name = parts[0..index].join("::") eval("module #{sub_name}; end") end clazz = eval(name) + clazz.unloadable if clazz.respond_to?(:unloadable) clazz.class_eval(&block) if block_given? clazz end + +=begin +def add_module(name, &block) + define_module(name).class_eval do + class << self; self; end.send(:define_method, :included) { |base| + base.class_eval(&block) + } + end +end +=end \ No newline at end of file