lib/usable/mod_extender.rb in usable-0.3.0 vs lib/usable/mod_extender.rb in usable-1.0.0

- old
+ new

@@ -2,27 +2,27 @@ class ModExtender attr_accessor :copy, :mod, :config def initialize(mod, config = OpenStruct.new) @mod = mod - @copy = has_spec? ? mod.const_get(:Spec).dup : mod.dup + @copy = has_spec? ? mod.const_get(:UsableSpec).dup : mod.dup @config = config end + # @note Destructive def call - copy.prepend override + override + copy end def override unwanted = config.only ? copy.instance_methods - Array(config.only) : [] - Module.new do - unwanted.each do |method_name| - define_method(method_name) { |*| } - end + unwanted.each do |method_name| + copy.send :remove_method, method_name end end def has_spec? - mod.const_defined?(:Spec) + mod.const_defined?(:UsableSpec) end end end