lib/mutant/require_highjack.rb in mutant-0.8.10 vs lib/mutant/require_highjack.rb in mutant-0.8.11

- old
+ new

@@ -8,13 +8,17 @@ # @param [#call] callback # # @return [#call] # the original implementation on singleton def self.call(target, callback) - target.method(:require).tap do + target.public_method(:require).tap do target.module_eval do + undef_method(:require) define_method(:require, &callback) - public :require + class << self + undef_method(:require) + end + define_singleton_method(:require, &callback) end end end end # RequireHighjack