Sha256: 6ea2356075ec97b4542f815136d79cbcb2a790016b8ad24bde3a6c9397b764a6
Contents?: true
Size: 618 Bytes
Versions: 6
Compression:
Stored size: 618 Bytes
Contents
module Mutant # 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 # Mutant
Version data entries
6 entries across 6 versions & 1 rubygems