Created
June 20, 2015 15:15
-
-
Save enil/35bacf0d8b4814975f16 to your computer and use it in GitHub Desktop.
A bit of Ruby sugar for boolean values
This file contains 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 | |
!!self | |
end | |
alias true? to_bool | |
def false? | |
!true? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment