Class: Numeric
Instance Method Summary collapse
-
#to_bool ⇒ Object
(also: #to_b)
Returns + true+ if the receiver, converted to float, is equal to
1.0,falseif it is equal0.0, ornilotherwise.
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 it is equal 0.0, or nil otherwise.
44 45 46 47 48 49 |
# File 'lib/certainty.rb', line 44 def to_bool { 1.0 => true, 0.0 => false }[to_f] end |