Created
August 10, 2011 15:03
-
-
Save jish/1137038 to your computer and use it in GitHub Desktop.
$LOADED_FEATURES
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
| puts ' - required foo.' | |
| class Foo | |
| end |
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
| puts "Requiring foo the first time" | |
| require 'foo' | |
| puts "Trying to require foo again" | |
| require 'foo' | |
| puts "Removing foo from $LOADED_FEATURES" | |
| $LOADED_FEATURES.reject! { |feature| feature == '/Users/josh/code/ruby/sandbox/foo.rb' } | |
| puts "Trying to require foo again" | |
| require 'foo' | |
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
| $ ruby loaded_features.rb | |
| Requiring foo the first time | |
| - required foo. | |
| Trying to require foo again | |
| Removing foo from $LOADED_FEATURES | |
| Trying to require foo again | |
| - required foo. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment