From: Clifford Heath Date: 2011-04-15T07:05:39+09:00 Subject: [ruby-core:35757] Re: [Ruby 1.9 - Feature #4574] Numeric#within On 14/04/2011, at 9:40 PM, Nikolai Weibull wrote: > On Thu, Apr 14, 2011 at 12:49, 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.