lib/powercore/integer.rb
# Clamps a comparable between a lower and upper bound.
Clamps a comparable between a lower and upper bound.
Clamps a comparable between a lower and upper bound .
def clamp(min, max = nil)
    if max.nil? && min.is_a?(Range)
      self < min.min ? min.min : self > min.max ? min.max : self
    else
      self < min ? min : self > max ? max : self
    end
  end
def clamp ( min , max = nil ) if max . nil? && min . is_a? ( Range ) self < min . min ? min . min : self > min . max ? min . max : self else self < min ? min : self > max ? max : self end end
Clamps a comparable between a lower and upper bound.
Clamps a comparable between a lower and upper bound .
min
<not_specific>
max
<not_specific>