Class: Float

Inherits:
Object show all
Defined in:
lib/mug/bool.rb

Instance Method Summary collapse

Instance Method Details

#to_bBoolean

Converts num to a boolean. Returns true if not zero or NaN. Note: -0.0 is false, and +/-infinity are true.

Returns:

  • (Boolean)

    true if self is non-zero and not NaN



88
89
90
# File 'lib/mug/bool.rb', line 88

def to_b
  !(self.zero? || self.nan?)
end