Is there a method to limit/clamp a number? December 18, 2023 by Tarik Ruby 2.4.0 introduces Comparable#clamp: 523.clamp(0, 100) #=> 100