Method: String#to_bool
- Defined in:
- lib/epb_view_models.rb
#to_bool ⇒ Object
14 15 16 17 18 19 |
# File 'lib/epb_view_models.rb', line 14 def to_bool return true if self == true || self =~ /(true|t|yes|y|1)$/i return false if self == false || blank? || self =~ /(false|f|no|n|0)$/i raise ArgumentError, "invalid value for Boolean: \"#{self}\"" end |