On 14/04/2011, at 9:40 PM, Nikolai Weibull wrote:
> On Thu, Apr 14, 2011 at 12:49,  <redmine / ruby-lang.org> wrote:
>> I think Numeric#within is perhaps less intuitive than something  
>> like Range#bound or Range#trim. It feels more natural to have it be  
>> a method on Range. I like Range#clamp but it might not be so  
>> obvious that restricts the argument to within the range; then  
>> again, (2..5).restrict(6) might lack some aesthetic appeal.
>
> In my mind, Numeric#clamp is the right choice:

clamp is also the term used in electronics for this function.

Clifford Heath.