Sha256: 29fee06e2371c2b67adf8b1666cecbbccd97d81a90a1c4934c1f3cf6520385d1
Contents?: true
Size: 616 Bytes
Versions: 8
Compression:
Stored size: 616 Bytes
Contents
module Mutest # Require highjack module RequireHighjack # Install require callback # # @param [Module] target # @param [#call] callback # # @return [#call] # the original implementation on singleton def self.call(target, callback) target.public_method(:require).tap do target.module_eval do undef_method(:require) define_method(:require, &callback) class << self undef_method(:require) end define_singleton_method(:require, &callback) end end end end # RequireHighjack end # Mutest
Version data entries
8 entries across 8 versions & 1 rubygems