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