Skip to content

Instantly share code, notes, and snippets.

@henrik
Last active September 25, 2022 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save henrik/4ab3665cb298900458394bd80b8d6a22 to your computer and use it in GitHub Desktop.
Save henrik/4ab3665cb298900458394bd80b8d6a22 to your computer and use it in GitHub Desktop.
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
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