Skip to content

Instantly share code, notes, and snippets.

@cyrilchampier
Created December 18, 2018 13:14
Show Gist options
  • Save cyrilchampier/2860f161962d6dcd78be5164c7735129 to your computer and use it in GitHub Desktop.
Save cyrilchampier/2860f161962d6dcd78be5164c7735129 to your computer and use it in GitHub Desktop.
broken code to demonstrate module nesting behavior
module A1
REACHABLE = true
module B1
NESTING = Module.nesting
def self.reachable?
REACHABLE
end
end
end
module A2
REACHABLE = false
end
module A2::B2
NESTING = Module.nesting
def self.reachable?
REACHABLE
end
end
A1::B1::NESTING
A2::B2::NESTING
A1::B1.reachable?
A2::B2.reachable?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment