Last active
December 23, 2015 07:39
-
-
Save amiel/6602750 to your computer and use it in GitHub Desktop.
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 Foo | |
class Bar;end | |
end | |
module Foo | |
class Baz | |
# lookup order: Foo::Baz::Bar, Foo::Bar, Bar | |
Bar.new # => #<Foo::Bar:...> | |
end | |
end | |
class Foo::Baz | |
# Note that here it skips lookup for Foo::Bar. This is because | |
# we are not in the Foo namespace, only in the Foo::Baz namespace | |
# lookup order: Foo::Baz::Bar, Bar | |
Bar.new # => NameError: uninitialized constant Foo::Baz::Bar | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment