Created
August 13, 2011 03:12
-
-
Save steveklabnik/1143436 to your computer and use it in GitHub Desktop.
Duck typing!
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 Something | |
| def hey | |
| "hello" | |
| end | |
| end | |
| class OtherThing | |
| def hey | |
| "hi" | |
| end | |
| end | |
| def do_it(thing) | |
| puts thing.hey | |
| end | |
| s = Something.new | |
| o = OtherThing.new | |
| do_it(s) | |
| do_it(o) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment