lib/bogus/copies_classes.rb in bogus-0.0.3.rc.1 vs lib/bogus/copies_classes.rb in bogus-0.0.3.rc.2

- old
+ new

@@ -1,40 +1,14 @@ module Bogus class CopiesClasses extend Takes - takes :makes_substitute_methods + takes :copies_methods def copy(klass) copy_class = Class.new(Bogus::Fake) - copy_class.__copied_class__ = klass - copy_instance_methods(klass, copy_class) - copy_class_methods(klass, copy_class) - - return copy_class + copies_methods.copy(klass, copy_class) + copy_class end - - private - - def copy_instance_methods(klass, copy_class) - instance_methods = klass.instance_methods - Object.instance_methods - - instance_methods.each do |name| - copy_class.class_eval(method_as_string(klass.instance_method(name))) - end - end - - def copy_class_methods(klass, copy_class) - klass_methods = klass.methods - Class.methods - - klass_methods.each do |name| - copy_class.instance_eval(method_as_string(klass.method(name))) - end - end - - def method_as_string(method) - makes_substitute_methods.stringify(method) - end - end end