I'm wondering to know whether use-cases, mentioned in https://bugs.ruby-lang.org/issues/15831#note-9, are good enough to reconsider the decision to add these methods to Ruby?bogdanvlviv (Bogdan Denkovych)
> I also concern about the name conflict with the ActiveSupport method. I guess this comment addressed https://bugs.ruby-lang.org/issues/15863 that adds `Hash#slice!`, right? Active Support doesn't have any `extract` methods, only `e...bogdanvlviv (Bogdan Denkovych)
> Let me see the real-world use-case, please. Since proposed `Hash#slice!` method is the same as `Hash#extract!` from the Active Support, there is one use-case where we have some `options` then we extract some known by keys options an...bogdanvlviv (Bogdan Denkovych)
matz (Yukihiro Matsumoto) wrote: > I don't think we have seen the use-case that this method is absolutely necessary. I also concern about the name conflict with the ActiveSupport method. > ... There are use-cases of `Array#extract` in ...bogdanvlviv (Bogdan Denkovych)
* [Feature #15863] Add `Hash#slice!` and `ENV.slice!`(bogdanvlviv) * I would like to discuss these methods(name, behavior, implementation), and whether we want to add them to Ruby. * [Feature #15831] Add `Array#extract`, `Hash#extrac...bogdanvlviv (Bogdan Denkovych)
## Add `Hash#slice!` In https://bugs.ruby-lang.org/issues/8499 we added `Hash#slice`. `Hash#slice!` removes and returns the key/value pairs matching the given keys: ```ruby h = {a: 100, b: 200, c: 300} h.slice!(:a) # => {:a=>1...bogdanvlviv (Bogdan Denkovych)
I just changed the implementation of `Hash#extract` and `ENV::extract` as it's described in the previous note https://bugs.ruby-lang.org/issues/15831#note-4bogdanvlviv (Bogdan Denkovych)
nobu (Nobuyoshi Nakada) wrote: > Why `Array#extract` has no argument but takes a block, while `Hash` and `ENV` are opposite? I implemented those methods to mirror similar behavior as it is in Active Support, but I also feel like we...bogdanvlviv (Bogdan Denkovych)