Project

General

Profile

Actions

Feature #14128

open

Introduce Hash#delete default value

Added by gshutler (Garry Shutler) over 6 years ago. Updated over 6 years ago.

Status:
Open
Target version:
-
[ruby-core:83870]

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)
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0