Actions
Feature #14128
openIntroduce Hash#delete default value
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)
Updated by shevegen (Robert A. Heiler) almost 7 years ago
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.
Updated by nobu (Nobuyoshi Nakada) almost 7 years ago
- Tracker changed from Bug to Feature
- Backport deleted (
2.3: UNKNOWN, 2.4: UNKNOWN)
Updated by gshutler (Garry Shutler) almost 7 years ago
Sorry, I thought I was recording it as a feature request. Thanks for fixing nobu.
Updated by marcandre (Marc-Andre Lafortune) almost 7 years ago
- Assignee set to matz (Yukihiro Matsumoto)
I am in favor of this.
Updated by hsbt (Hiroshi SHIBATA) 8 months ago
- Status changed from Open to Assigned
Actions
Like0
Like0Like0Like0Like0Like0