Module: EqualityWarning
- Defined in:
- lib/inexact_equality_warning.rb
Overview
it would be good to use #inexact? here – bugs.ruby-lang.org/issues/5321
Instance Method Summary collapse
Instance Method Details
#==(other) ⇒ Object
3 4 5 6 |
# File 'lib/inexact_equality_warning.rb', line 3 def ==(other) warn "WARNING: Testing for equality between inexact floats is ill-advised, when comparing #{self} and #{other} (#{caller.first})" if (self.is_a?(Numeric) && other.is_a?(Numeric)) && self.is_a?(Float) || other.is_a?(Float) super end |