[#79532] Immutable Strings vs Symbols — Daniel Ferreira <subtileos@...>

Hi,

15 messages 2017/02/15

[ruby-core:79539] [Ruby trunk Feature#13211] Hash#delete taking a splat

From: kevin.deisz@...
Date: 2017-02-15 13:41:11 UTC
List: ruby-core #79539
Issue #13211 has been updated by Kevin Deisz.


Okay, yes, an arbitrary number of arguments. Is this something to which people would be amenable?

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

* Author: 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.



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

In This Thread

Prev Next