Last active
August 12, 2017 00:55
-
-
Save hoffm/199236fe54fea9423ff86a16591d980e 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
class MyClass | |
def foo_via_method | |
p "Superclass Chain: #{self.class.ancestors}" | |
p "Lexical Scope Chain: #{Module.nesting}" | |
foo_method | |
end | |
def foo_via_constant | |
p "Superclass Chain: #{self.class.ancestors}" | |
p "Lexical Scope Chain: #{Module.nesting}" | |
FOO_CONSTANT | |
end | |
end | |
class SubClass < MyClass | |
FOO_CONSTANT = "foo" | |
def foo_method | |
FOO_CONSTANT | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment