Sha256: c0c972d5efb54f88e7385e587f7b20a42a7f64d6d2031c74f6f6461c84a0867c

Contents?: true

Size: 501 Bytes

Versions: 8

Compression:

Stored size: 501 Bytes

Contents

module Mutant
  # Require highjack
  module RequireHighjack

    # Install require callback
    #
    # @param [Module] target
    # @param [#call] callback
    #
    # @return [#call]
    #   the original implementation on singleton
    #
    # @api private
    def self.call(target, callback)
      target.method(:require).tap do
        target.module_eval do
          define_method(:require, &callback)
          public :require
        end
      end
    end

  end # RequireHighjack
end # Mutant

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mutant-0.8.8 lib/mutant/require_highjack.rb
mutant-0.8.7 lib/mutant/require_highjack.rb
mutant-0.8.6 lib/mutant/require_highjack.rb
mutant-0.8.5 lib/mutant/require_highjack.rb
mutant-0.8.4 lib/mutant/require_highjack.rb
mutant-0.8.3 lib/mutant/require_highjack.rb
mutant-0.8.2 lib/mutant/require_highjack.rb
mutant-0.8.1 lib/mutant/require_highjack.rb