Class: Fixnum
- Inherits:
-
Object
- Object
- Fixnum
- Defined in:
- lib/roqua/core_ext/fixnum/clamp.rb
Instance Method Summary collapse
Instance Method Details
#clamp(low, high) ⇒ Object
2 3 4 5 6 7 |
# File 'lib/roqua/core_ext/fixnum/clamp.rb', line 2 def clamp(low, high) raise "Low (#{low}) must be lower than high (#{high})" unless low < high return low if self < low return high if self > high self end |