Last active
March 27, 2025 01:59
-
-
Save jackjennings/8a02f30fb15a6fa9be9e221fe92e12d7 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
Object.class_eval do | |
def self.const_added(const_name) | |
super | |
if !const_name.to_s.upcase! | |
self.private_constant const_name | |
end | |
end | |
end | |
class Foo | |
BAR = 1 | |
end | |
puts Foo::BAR | |
# => private constant Foo::BAR referenced (NameError) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment