[#107867] Fwd: [ruby-cvs:91197] 8f59482f5d (master): add some tests for Unicode Version 14.0.0 — Martin J. Dürst <duerst@...>
To everybody taking care of continuous integration:
3 messages
2022/03/13
[#108090] [Ruby master Bug#18666] No rule to make target 'yaml/yaml.h', needed by 'api.o' — duerst <noreply@...>
Issue #18666 has been reported by duerst (Martin D端rst).
7 messages
2022/03/28
[#108117] [Ruby master Feature#18668] Merge `io-nonblock` gems into core — "Eregon (Benoit Daloze)" <noreply@...>
Issue #18668 has been reported by Eregon (Benoit Daloze).
22 messages
2022/03/30
[ruby-core:107783] [Ruby master Misc#18609] keyword decomposition in enumerable (question/guidance)
From:
"Ethan (Ethan -)" <noreply@...>
Date:
2022-03-06 02:15:40 UTC
List:
ruby-core #107783
Issue #18609 has been updated by Ethan (Ethan -).
thank you all for the feedback and suggestions, much appreciated.
----------------------------------------
Misc #18609: keyword decomposition in enumerable (question/guidance)
https://bugs.ruby-lang.org/issues/18609#change-96705
* Author: Ethan (Ethan -)
* Status: Closed
* Priority: Normal
----------------------------------------
There is a pattern that I have used somewhat often in ruby 2, decomposing hash keys as keyword arguments to blocks for Enumerable, which no longer works in ruby 3. I'm wondering if there is a better way that I am missing (I couldn't find any discussion of this particular thing searching this tracker).
```ruby
drafts = [
{name: 'draft4', mod: :Draft04, image: 'draft4.png'},
{name: 'draft6', mod: :Draft06, image: 'draft6.jpg'},
]
# ruby 2
drafts.each do |name: , mod: , image: |
...
# ruby 3
drafts.each do |draft|
name = draft[:name]
mod = draft[:mod]
image = draft[:image]
...
```
the latter is much more cumbersome, but seems necessary with the switch in keyword argument handling in ruby 3.
I can refactor to `name, mod, image = draft[:name], draft[:mod], draft[:image]`. that is a little better but still more verbose and repetitive than it used to be, and with more keys the line gets very long.
I am expecting this pattern is just a casualty of the keyword split that I will have to rewrite and this issue can be closed, but hoping there may be some better option I have missed.
--
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>