Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/safebool.rb
Instance Method Summary collapse
Instance Method Details
#parse_bool ⇒ Object
151 |
# File 'lib/safebool.rb', line 151 def parse_bool() Bool.parse( self ); end |
#to_b ⇒ Object
142 143 144 145 146 147 148 149 150 |
# File 'lib/safebool.rb', line 142 def to_b if strip.empty? ## add special case for empty / blank strings - return false (!) value = false else value = parse_bool() value = true if value.nil? ## note: return true for all undefined / unknown string values that cannot convert to bool (except empty string) value end end |