-
-
Save xinuc/9dc7882ade6425e910ff2e663c087674 to your computer and use it in GitHub Desktop.
prepend.rb
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 Hello | |
| def say | |
| puts "hello" | |
| end | |
| end | |
| Hello.new.say | |
| # hello | |
| module HelloPatch | |
| def say | |
| puts "patching" | |
| super | |
| end | |
| end | |
| class Hello | |
| prepend HelloPatch | |
| end | |
| Hello.new.say | |
| # patching | |
| # hello |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment