Created
May 17, 2015 19:20
-
-
Save dinks/22ec4bcf511defab3745 to your computer and use it in GitHub Desktop.
Autoload pitfalls
This file contains 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
# qux.rb | |
Qux = "I'm at the root!" | |
# foo.rb | |
module Foo | |
end | |
# foo/qux.rb | |
module Foo | |
Qux = "I'm in Foo!" | |
end | |
# foo/bar.rb | |
class Foo::Bar | |
def self.print_qux | |
puts Qux | |
end | |
end | |
# Ruby | |
"I'm at the root!" | |
# Rails, because of autoloading | |
"I'm in Foo!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment