Class: String
Instance Method Summary collapse
-
#to_bool ⇒ Object
(also: #to_b)
Returns
true
if, downcased, the receiver is “1” or “true”,false
if “0” or “false”, ornil
otherwise.
Instance Method Details
#to_bool ⇒ Object Also known as: to_b
Returns true
if, downcased, the receiver is “1” or “true”, false
if “0” or “false”, or nil
otherwise.
31 32 33 34 35 36 37 38 |
# File 'lib/certainty.rb', line 31 def to_bool { '1' => true, 'true' => true, '0' => false, 'false' => false }[downcase] end |