Module: Boolean
- Defined in:
- lib/haveapi/types.rb
Overview
Just to represent boolean type in self-description
Class Method Summary collapse
Class Method Details
.to_b(str) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/haveapi/types.rb', line 3 def self.to_b(str) return true if str === true return false if str === false if str.respond_to?(:=~) return true if str =~ /^(true|t|yes|y|1)$/i return false if str =~ /^(false|f|no|n|0)$/i end false end |