Created
November 4, 2015 03:34
-
-
Save ngtk/fec38aa71e98cb74a8e5 to your computer and use it in GitHub Desktop.
refinements 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 PartyPeople | |
| refine Human do | |
| def say | |
| puts "hooooo!!!" | |
| end | |
| end | |
| end | |
| module AnyModule | |
| using PartyPeople | |
| 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