Issue #13211 has been updated by kddeisz (Kevin Deisz).

File hash-delete-multiple.patch added

I've attached a patch of what I'm talking about, which should hopefully be more clear. The idea is that you could delete multiple values from a hash at once, which is valuable in its own right. Additionally, the return value is changed to be an array if multiple arguments are passed, representing the deleted values.

This is my first time contributing and I'm not sure if I'm doing everything right, so please any feedback is welcome.

----------------------------------------
Feature #13211: Hash#delete taking a splat
https://bugs.ruby-lang.org/issues/13211#change-64570

* Author: kddeisz (Kevin Deisz)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
----------------------------------------
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)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>