Created
November 20, 2020 04:16
-
-
Save ujihisa/e44db75b54b4fc5109a46e4eabff53f7 to your computer and use it in GitHub Desktop.
This file contains 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
# See line 5 | |
class C | |
using(Module.new do | |
refine C.singleton_class do | |
def secret | |
123 | |
end | |
end | |
end) | |
def f | |
C.secret | |
end | |
def self.g | |
C.secret | |
end | |
end | |
p C.new.f # 123 | |
p C.g # 123 | |
p C.secret # NoMethodError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment