Method: String#to_bool
- Defined in:
- lib/protk/psm.rb
#to_bool ⇒ Object
9 10 11 12 13 |
# File 'lib/protk/psm.rb', line 9 def to_bool return true if self == true || self =~ (/^(true|t|yes|y|1)$/i) return false if self == false || self =~ (/^(false|f|no|n|0)$/i) raise ArgumentError.new("invalid value for Boolean: \"#{self}\"") end |