Created
February 17, 2016 00:53
-
-
Save danielfone/2aaf1e8a582a22080d1a to your computer and use it in GitHub Desktop.
Reopening classes
This file contains hidden or 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
| $ ruby -v | |
| ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15] | |
| $ pry | |
| [1] pry(main)> class Animal | |
| [1] pry(main)* def noise | |
| [1] pry(main)* "bump" | |
| [1] pry(main)* end | |
| [1] pry(main)* end | |
| => :noise | |
| [2] pry(main)> class Dog < Animal | |
| [2] pry(main)* def noise | |
| [2] pry(main)* "woof" | |
| [2] pry(main)* end | |
| [2] pry(main)* end | |
| => :noise | |
| [3] pry(main)> Dog.new.noise | |
| => "woof" | |
| [4] pry(main)> class Dog | |
| [4] pry(main)* def noise | |
| [4] pry(main)* "bark" | |
| [4] pry(main)* end | |
| [4] pry(main)* end | |
| => :noise | |
| [5] pry(main)> Dog.new.noise | |
| => "bark" | |
| [6] pry(main)> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment