Last active
September 25, 2022 08:32
-
-
Save henrik/4ab3665cb298900458394bd80b8d6a22 to your computer and use it in GitHub Desktop.
Object.is_a?(Object) funkiness https://twitter.com/henrik/status/1573952719735455744
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
class Foo | |
private | |
def bar = "bar" | |
end | |
foo = Foo.new | |
p foo.methods.include?(:bar) # => false | |
p foo.method(:bar) # Method | |
p Foo.instance_method(:bar) # Method |
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
class Object | |
private | |
def bar = "bar" | |
end | |
foo = Object | |
p foo.methods.include?(:bar) # => false | |
p foo.method(:bar) # Method | |
p Object.instance_method(:bar) # Method |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment