[#92891] Question: ruby 2.7.0-preview1 also upgrades bundler to 2.1.0.pre.1? — Al Snow <jasnow@...>
Tried the new 2.7.0-preview1 upgrade to Ruby and see that bundler is also upgraded (to 2.1.0.pre.1).
5 messages
2019/05/30
[#92892] Re: Question: ruby 2.7.0-preview1 also upgrades bundler to 2.1.0.pre.1?
— SHIBATA Hiroshi <hsbt@...>
2019/05/30
Bundler 2.1.0.pree.1 is the expected version.
[ruby-core:92789] [Ruby trunk Bug#15867] Enumerable#minmax inconsistent behavior with Time ranges
From:
arzezak@...
Date:
2019-05-22 21:52:37 UTC
List:
ruby-core #92789
Issue #15867 has been reported by arzezak (Ariel Rzezak).
----------------------------------------
Bug #15867: Enumerable#minmax inconsistent behavior with Time ranges
https://bugs.ruby-lang.org/issues/15867
* Author: arzezak (Ariel Rzezak)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.2p47 (2019-03-13 revision 67232) [x86_64-darwin17]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
With `Date` the behavior is consistent for inclusive and exclusive ranges:
```
>> (Date.new(2019, 7, 1)..Date.new(2019, 7, 3)).min
=> #<Date: 2019-07-01 ((2458666j,0s,0n),+0s,2299161j)>
>> (Date.new(2019, 7, 1)..Date.new(2019, 7, 3)).max
=> #<Date: 2019-07-03 ((2458668j,0s,0n),+0s,2299161j)>
>> (Date.new(2019, 7, 1)..Date.new(2019, 7, 3)).minmax
=> [#<Date: 2019-07-01 ((2458666j,0s,0n),+0s,2299161j)>, #<Date: 2019-07-03 ((2458668j,0s,0n),+0s,2299161j)>]
>> (Date.new(2019, 7, 1)...Date.new(2019, 7, 3)).minmax
=> [#<Date: 2019-07-01 ((2458666j,0s,0n),+0s,2299161j)>, #<Date: 2019-07-02 ((2458667j,0s,0n),+0s,2299161j)>]
```
With `Time` and inclusive ranges `min` and `max` are returned.
```
>> (Time.new(2019, 7, 1, 10)..Time.new(2019, 7, 1, 12)).min
=> 2019-07-01 10:00:00 -0300
>> (Time.new(2019, 7, 1, 10)..Time.new(2019, 7, 1, 12)).max
=> 2019-07-01 12:00:00 -0300
```
But `minmax` raises a `TypeError`:
```
Traceback (most recent call last):
6: from /Users/ariel/.rbenv/versions/2.6.2/bin/irb:23:in `<main>'
5: from /Users/ariel/.rbenv/versions/2.6.2/bin/irb:23:in `load'
4: from /Users/ariel/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
3: from (irb):8
2: from (irb):8:in `minmax'
1: from (irb):8:in `each'
TypeError (can't iterate from Time)
```
For exclusive ranges `min` is returned but `max` raises.
```
>> (Time.new(2019, 7, 1, 10)...Time.new(2019, 7, 1, 12)).min
=> 2019-07-01 10:00:00 -0300
>> (Time.new(2019, 7, 1, 10)...Time.new(2019, 7, 1, 12)).max
Traceback (most recent call last):
7: from /Users/ariel/.rbenv/versions/2.6.2/bin/irb:23:in `<main>'
6: from /Users/ariel/.rbenv/versions/2.6.2/bin/irb:23:in `load'
5: from /Users/ariel/.rbenv/versions/2.6.2/lib/ruby/gems/2.6.0/gems/irb-1.0.0/exe/irb:11:in `<top (required)>'
4: from (irb):11
3: from (irb):11:in `max'
2: from (irb):11:in `max'
1: from (irb):11:in `each'
TypeError (can't iterate from Time)
```
If `min` and `max` are returned for an inclusive `Time` range, shouldn't `minmax` be returned as well?
Thanks!
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>