[#70843] Re: [ruby-cvs:58952] hsbt:r51801 (trunk): * lib/rubygems: Update to RubyGems HEAD(fe61e4c112). — Eric Wong <normalperson@...>
hsbt@ruby-lang.org wrote:
3 messages
2015/09/17
[ruby-core:70810] [Ruby trunk - Feature #10594] Comparable#clamp
From:
hanmac@...
Date:
2015-09-15 05:24:43 UTC
List:
ruby-core #70810
Issue #10594 has been updated by Hans Mackowiak. Motohiro KOSAKI wrote: > I really dislike using Comparable for this method because clamp is NOT kind of compare. If it is Numeric's method, I'm OK. hm imo its better in Comparable than in Numeric because it does work for non Numeric objects too, like for String thats why its better central in Comparable than in Numeric. ---------------------------------------- Feature #10594: Comparable#clamp https://bugs.ruby-lang.org/issues/10594#change-54192 * Author: Chris Johnson * Status: Open * Priority: Normal * Assignee: ---------------------------------------- This is basically a re-opening of the feature request of issue#4573 (https://bugs.ruby-lang.org/issues/4574), which was closed due a naming debate. It seems the standard naming for restricting a number to a specified range is indeed 'clamp'. (1)(2)(3) As such, can we use Yusuke Endoh's original patch with the naming adjustments? If so, I can provide accordingly. Cheers. (1) http://www.rubydoc.info/github/epitron/epitools/Numeric:clamp (2) http://stackoverflow.com/questions/12020787/is-there-a-limit-clamp-function-in-ruby (3) https://developer.gnome.org/glib/stable/glib-Standard-Macros.html#CLAMP:CAPS ---Files-------------------------------- num_clamp.c (427 Bytes) comparable-clamp.diff (2.52 KB) -- https://bugs.ruby-lang.org/