Last active
December 17, 2015 20:19
-
-
Save davidbalbert/5667013 to your computer and use it in GitHub Desktop.
Ruby should have more multimedia!
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
>> load 'string_sayer.rb' | |
>> "Hello, world!" | |
=> "Hello, world!" |
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
module StringSayer | |
def inspect | |
s = super | |
`say #{s}` | |
s | |
end | |
end | |
String.send(:prepend, StringSayer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment