I add a method to Numeric
class like this:
class Numeric
def limitate(min, max)
return self if self.between?(min,max)
return max if self > max
min
end
end
I want to get a value if the value is in a specified range, and if it is outside range it should return maximum or minimum value.
Can I write it more simply? And how?