Class: Numeric
Instance Method Summary collapse
-
#to_bool ⇒ Object
(also: #to_b)
Returns
true
if the receiver, converted to float, is equal to1.0
,false
if0.0
, ornil
otherwise.
Instance Method Details
#to_bool ⇒ Object Also known as: to_b
Returns true
if the receiver, converted to float, is equal to 1.0
, false
if 0.0
, or nil
otherwise.
45 46 47 48 49 50 |
# File 'lib/certainty.rb', line 45 def to_bool { 1.0 => true, 0.0 => false }[to_f] end |