Created
December 4, 2015 12:13
-
-
Save jazzytomato/3bf9ebaad177807059a5 to your computer and use it in GitHub Desktop.
string to boolean
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
def to_bool(str) | |
str == true || str =~ (/^(true|1)$/) ? true : false | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment