Skip to content

Instantly share code, notes, and snippets.

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