Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/mn_utils_gem/string_to_bool.rb
Instance Method Summary collapse
Instance Method Details
#to_bool ⇒ Object
2 3 4 5 6 7 |
# File 'lib/mn_utils_gem/string_to_bool.rb', line 2 def to_bool return true if self =~ (/^(true|t|yes|y|1)$/i) return false if self.empty? || self =~ (/^(false|f|no|n|0)$/i) raise ArgumentError.new "invalid value: #{self}" end |