Class: Numeric
Instance Method Summary collapse
Instance Method Details
#clamp(range) ⇒ Object
2 3 4 5 6 7 8 9 10 |
# File 'lib/tfg/support/core_ext/numeric/clamp.rb', line 2 def clamp(range) if self < range.min range.min elsif self > range.max range.max else self end end |