Created
May 28, 2010 22:34
-
-
Save ymendel/417845 to your computer and use it in GitHub Desktop.
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 Object | |
| def to_bool | |
| TrueClass === self | |
| end | |
| end | |
| class Numeric | |
| def to_bool | |
| return false if self == 0 | |
| return true | |
| end | |
| end | |
| class Float | |
| def to_bool | |
| return false if self == 0.0 | |
| return true | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment