Skip to content

Instantly share code, notes, and snippets.

@jraregris
Created February 2, 2015 14:35
Show Gist options
  • Save jraregris/abb57fdb3ca24b4df180 to your computer and use it in GitHub Desktop.
Save jraregris/abb57fdb3ca24b4df180 to your computer and use it in GitHub Desktop.
⮁ pry
[1] pry(main)> class Parent
[1] pry(main)* private
[1] pry(main)* def honk
[1] pry(main)* puts "hooonk"
[1] pry(main)* end
[1] pry(main)* end
=> :honk
[2] pry(main)> class Child < Parent
[2] pry(main)* end
=> nil
[3] pry(main)> c = Child.new
=> #<Child:0x50e90>
[4] pry(main)> c.honk
NoMethodError: private method `honk' called on an instance of Child.
from kernel/delta/kernel.rb:78:in `honk (method_missing)'
[5] pry(main)> class Child
[5] pry(main)* def bongo
[5] pry(main)* honk
[5] pry(main)* end
[5] pry(main)* end
=> :bongo
[6] pry(main)> c.bongo
hooonk
=> nil
[7] pry(main)>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment