Project

General

Profile

Actions

Feature #13211

closed

Hash#delete taking a splat

Added by kddnewton (Kevin Newton) about 7 years ago. Updated 9 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:79520]

Description

Hi there,

I would like to add the ability for Hash#delete to take a splat of arguments that would delete entries at each of the given keys. I've run into this quite a few times where it would be useful in application code. Something like

def preprocess(args = {})
  do_some_preprocessing(%i[a b c].zip(args.delete(:a, :b, :c)).to_h)
  process(args)
end

Would be very happy to work on a patch for this if it's desired.


Files

hash-delete-multiple.patch (3.35 KB) hash-delete-multiple.patch kddnewton (Kevin Newton), 04/29/2017 08:40 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0