Created
July 13, 2010 11:22
-
-
Save trans/473745 to your computer and use it in GitHub Desktop.
Where is date.rb coming from?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Kernel | |
| alias_method :old_require, :require | |
| alias_method :old_load, :load | |
| alias_method :old_autoload, :autoload | |
| def require(path) | |
| p "require: #{path}" | |
| old_require(path) | |
| end | |
| module_function :require | |
| def load(path, wrap=nil) | |
| p "load: #{path}" | |
| old_load(path, wrap) | |
| end | |
| module_function :load | |
| def autoload(constant, path) | |
| p "autoload: #{path}" | |
| old_autoload(constant, path) | |
| end | |
| module_function :autoload | |
| end | |
| class Module | |
| alias_method :old_autoload, :autoload | |
| def autoload(constant, path) | |
| p "autoload: #{path}" | |
| old_autoload(constant, path) | |
| end | |
| def self.autoload(constant, path) | |
| p "autoload: #{path}" | |
| old_autoload(constant, path) | |
| end | |
| end | |
| # now the test | |
| l1 = $".dup | |
| require 'yaml' | |
| l2 = $".dup | |
| puts "LOADING YAML DOCUMENT" | |
| YAML.load <<-HERE | |
| date: 2010-10-01 | |
| HERE | |
| p $" - l2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment