def to_bool(string)
if string == true || string == 1 || string =~ (/(true|1)$/i)
true
else
false
end
end
Created
April 7, 2019 13:45
-
-
Save rodolfobandeira/e3e908e64dc62db0db86b115e45b059f to your computer and use it in GitHub Desktop.
Convert string to boolean in Ruby
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment