Created
November 4, 2015 04:07
-
-
Save ngtk/3d39d5c376173fc93b46 to your computer and use it in GitHub Desktop.
monkey patch pattern
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
| class Human | |
| def say | |
| puts "hello" | |
| end | |
| end | |
| module AnyModule | |
| class ::Human | |
| def say | |
| puts "hooooo!!!" | |
| end | |
| end | |
| bob = Human.new | |
| puts "bob:" | |
| bob.say | |
| end | |
| alice = Human.new | |
| puts "alice:" | |
| alice.say |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment