Feature #14128
open
Introduce Hash#delete default value
Added by gshutler (Garry Shutler) almost 7 years ago.
Updated 8 months ago.
Description
Mirror Hash#fetch(key [, default]) → obj
with Hash#delete(key [, default]) → obj
.
Allows for more concise extraction of a value from a hash with a default.
# Currently
a = hash.delete(:a) { 10 }
# Becomes
a = hash.delete(:a, 10)
I think this should be filed under features rather than bugs.
Here is a link to the documentation if anyone else wants to have
a look:
https://ruby-doc.org/core/Hash.html#method-i-delete
I am neither pro or con on the suggestion so I will not
comment on it - I only wanted to provide a quick link to
the docu so that others can find the most recent docu +
examples more easily.
- Tracker changed from Bug to Feature
- Backport deleted (
2.3: UNKNOWN, 2.4: UNKNOWN)
Sorry, I thought I was recording it as a feature request. Thanks for fixing nobu.
- Assignee set to matz (Yukihiro Matsumoto)
- Status changed from Open to Assigned
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0