Skip to content

Instantly share code, notes, and snippets.

@apeiros
Created September 5, 2013 12:38
Show Gist options
  • Save apeiros/6449542 to your computer and use it in GitHub Desktop.
Save apeiros/6449542 to your computer and use it in GitHub Desktop.
module A
X = 1
end
module A
class B
def self.x
X
end
end
end
class A::B
def self.y
X
end
end
c = A::B
def c.z
X
end
puts A::B.x # -> 1
puts A::B.y # -> NameError: uninitialized constant A::B::X
puts A::B.z # -> NameError: uninitialized constant A::B::X
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment