Hey all, this is something that’s come up again and again with various projects, and typecasting values from params as booleans. This could be represented as a
to_bool method added to the String class. Also, possibly to Fixnum, and I’ll explain why later.
I’m thinking the following values could be true:
“1”, “true”, “t”, “y”, “yes” (of course, case insensitive)
And the following values could be false:
“0”, “false”, “f”, “n”, “no” (again, case insensitive)
The reasoning for also including on Fixnum is to convert the 1/0 to true/false whether or not it’s a string.
Any thoughts on this? I couldn’t find any notes or discussions in this forum or in the repo about this. I have a branch ready to go, curious what the community thinks.