Просто идея, обезьяна исправляет класс Float
:
module MyFloatPatch
def within(percent: 0.0, of: 0.0)
(self - of).abs <= of * percent / 100.0
end
end
Float.include MyFloatPatch
5.25.within percent: 5, of: 5.0 #=> true
5.26.within percent: 5, of: 5.0 #=> false