Skip to content

Instantly share code, notes, and snippets.

@campbell
Forked from lmarburger/const_lookup.rb
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save campbell/3841cc86b092a08df5f8 to your computer and use it in GitHub Desktop.
Save campbell/3841cc86b092a08df5f8 to your computer and use it in GitHub Desktop.
class Outer
puts Module.nesting
A = 'outer'
end
puts Outer::A #=> outer
class Outer
class Inner
puts Module.nesting
puts A #=> outer
end
end
class Outer::Inner
puts Module.nesting
puts A
# const_lookup.rb:13:in `<class:Inner>': uninitialized constant Outer::Inner::A (NameError)
# from const_lookup.rb:12:in `<main>'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment