Created
November 19, 2012 03:41
-
-
Save jeffreyiacono/4108822 to your computer and use it in GitHub Desktop.
Ruby fun with UTF-8
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
| # encoding: UTF-8 | |
| class Weather | |
| def ☃ | |
| "I'm a snowman!" | |
| end | |
| def ☁ | |
| "Looking like a cloudy day" | |
| end | |
| def ☂ | |
| "It's going to rain" | |
| end | |
| def ☼ | |
| "Sun and fun are in your future" | |
| end | |
| end | |
| weather = Weather.new | |
| puts weather.☼ | |
| puts weather.☂ | |
| puts weather.☁ | |
| puts weather.☃ | |
| __END__ | |
| Did you know you can use UTF-8 characters in your Ruby code? | |
| Well, you can (see above!). Did you also know that anything | |
| after __END__ will NOT be evaluated? Well, it isn't. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment