Class: Numeric

Inherits:
Object show all
Defined in:
lib/scampi/monkey_patches.rb

Instance Method Summary collapse

Instance Method Details

#close?(to, delta) ⇒ Boolean

Check whether this number is within delta of to.

Returns:

  • (Boolean)


62
63
64
# File 'lib/scampi/monkey_patches.rb', line 62

def close?(to, delta)
  (to.to_f - self).abs <= delta.to_f  rescue false
end