Module: Corefines::String::ToB
- Defined in:
- lib/corefines/string.rb
Instance Method Summary collapse
-
#to_b ⇒ Boolean
Interprets common affirmative string meanings as
true, otherwisefalse.
Instance Method Details
#to_b ⇒ Boolean
Interprets common affirmative string meanings as true, otherwise
false. White spaces and case are ignored.
The following strings are interpreted as true:
'true', 'yes', 'on', 't', 'y', '1'.
401 402 403 404 405 406 407 |
# File 'lib/corefines/string.rb', line 401 module ToB refine ::String do def to_b %w[true yes on t y 1].include? self.downcase.strip end end end |