Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/core_ext/string.rb
Instance Method Summary collapse
-
#to_bool ⇒ Object
Convert string to bool.
Instance Method Details
#to_bool ⇒ Object
Convert string to bool
10 11 12 13 14 |
# File 'lib/core_ext/string.rb', line 10 def to_bool return true if self == true || self =~ (/(true|t|yes|y|1)$/i) return false if self == false || self.empty? || self =~ (/(false|f|no|n|0)$/i) return false end |