Module: BeBoolean
- Defined in:
- lib/be_boolean.rb
Class Method Summary collapse
Class Method Details
.get(val) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/be_boolean.rb', line 3 def self.get(val) return true if val.kind_of?(TrueClass) return false if val.kind_of?(FalseClass) if val.kind_of?(String) down = val.downcase return !!/1|true|t|yes|y/.match(down) end if val.kind_of?(Integer) || val.kind_of?(Float) return val != 0 end false end |