diff options
author | zverok <zverok.offline@gmail.com> | 2019-12-21 23:23:20 +0200 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2019-12-24 11:00:39 +0900 |
commit | f2e1e6cba451375d8eb839bf2e7c9a39bccc044c (patch) | |
tree | 4ca74f3679a69b63c0fbbe936618c429eb46adac /NEWS | |
parent | e954be14d07e54b8dbf71c0fa227e5818eaa01e6 (diff) |
Enhance explanations for beginless range and #clamp, and add missing feature
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2769
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -161,10 +161,19 @@ sufficient information, see the ChangeLog file or Redmine ==== Other miscellaneous changes -* A beginless range is experimentally introduced. It might not be as useful - as an endless range, but would be good for DSL purposes. [Feature #14799] +* A beginless range is experimentally introduced. It might be useful + in +case+, new call-sequence of the <code>Comparable#clamp</code>, + constants and DSLs. [Feature #14799] ary[..3] # identical to ary[0..3] + + case RUBY_VERSION + when ..."2.4" then puts "EOL" + # ... + end + + age.clamp(..100) + where(sales: ..100) * Setting <code>$;</code> to a non-nil value is warned now. @@ -246,6 +255,10 @@ Comparable:: -1.clamp(0..2) #=> 0 1.clamp(0..2) #=> 1 3.clamp(0..2) #=> 2 + # With beginless and endless ranges: + -1.clamp(0..) #=> 0 + 3.clamp(..2) #=> 2 + Complex:: @@ -414,6 +427,12 @@ Range:: * Added Range#minmax, with a faster implementation than Enumerable#minmax. It returns a maximum that now corresponds to Range#max. [Bug #15807] + Modified method:: + + * Range#=== now uses #cover? for String arguments, too (in Ruby 2.6, it was + changed from #include? for all types except strings). [Bug #15449] + + RubyVM:: Removed method:: |