Skip to content

Instantly share code, notes, and snippets.

@scottjacobsen
Created February 13, 2013 22:54
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 scottjacobsen/4949141 to your computer and use it in GitHub Desktop.
Save scottjacobsen/4949141 to your computer and use it in GitHub Desktop.
Derived classes can call a private method on a base class.
class MyBase
private
def priv
puts "private"
end
end
class MyDerived < MyBase
def foo
priv
end
end
[3] pry(main)> MyDerived.new.foo
private
=> nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment