Project

General

Profile

Actions

Feature #14128

open

Introduce Hash#delete default value

Added by gshutler (Garry Shutler) almost 4 years ago. Updated almost 4 years ago.

Status:
Open
Priority:
Normal
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