Created
January 12, 2018 19:23
-
-
Save drbrain/77717df191b79f4b349bca6fe27e4a17 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 A | |
module B | |
puts "module B inside module A nesting: #{Module.nesting}" | |
module_function | |
def show_nesting | |
puts "show_nesting nesting: #{Module.nesting}" | |
end | |
def yielder | |
yield | |
end | |
end | |
end | |
module A::B | |
puts "module A::B nesting: #{Module.nesting}" | |
end | |
A::B.show_nesting | |
A::B.yielder do | |
puts "A::B.yielder nesting: #{Module.nesting}" | |
end | |
include A::B | |
show_nesting | |
yielder do | |
puts "toplevel.yielder nesting: #{Module.nesting}" | |
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
module B inside module A nesting: [A::B, A] | |
module A::B nesting: [A::B] | |
show_nesting nesting: [A::B, A] | |
A::B.yielder nesting: [] | |
show_nesting nesting: [A::B, A] | |
toplevel.yielder nesting: [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment