Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/safebool.rb
Instance Method Summary collapse
- #to_b ⇒ Object (also: #to_bool)
Instance Method Details
#to_b ⇒ Object Also known as: to_bool
85 86 87 88 89 90 91 92 93 94 |
# File 'lib/safebool.rb', line 85 def to_b case self.downcase.strip when 'true', 'yes', 'on', 't', 'y', '1' return true ## when 'nil', 'null' # todo/discuss - add why? why not? ## return nil else return false end end |