Interesting idea just not sure if the string class would ever be
responsible for converting itself to another type. Interested in other
people's thoughts on this.

On Sunday, April 3, 2016, Clayton Liggitt <[email protected]> wrote:

> 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.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected]
> <javascript:_e(%7B%7D,'cvml','rubyonrails-core%[email protected]');>
> .
> To post to this group, send email to [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>.
> Visit this group at https://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to