Skip to content

Instantly share code, notes, and snippets.

@jish
Created August 10, 2011 15:03
Show Gist options
  • Select an option

  • Save jish/1137038 to your computer and use it in GitHub Desktop.

Select an option

Save jish/1137038 to your computer and use it in GitHub Desktop.
$LOADED_FEATURES
puts ' - required foo.'
class Foo
end
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'
$ 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