From: "Eregon (Benoit Daloze)" Date: 2012-06-03T03:04:23+09:00 Subject: [ruby-core:45392] [ruby-trunk - Feature #6532] More methods for Hash and Array: Hash#has_all_keys? and family, Array#delete_at for multiple arguments Issue #6532 has been updated by Eregon (Benoit Daloze). You should have a look at #values_at about #selection. I'm against has_*_keys?, because I think using any?,all?,... is clearer and not too verbose. (If it did look like C with an explicit loop, then I would consider it verbose). About #delete_at with multiple arguments, I'm neutral, because this is inherently inefficient because all the elements after the index being deleted need to be moved, at every single deletion. A Set might be more appropriate in these circumstances. ---------------------------------------- Feature #6532: More methods for Hash and Array: Hash#has_all_keys? and family, Array#delete_at for multiple arguments https://bugs.ruby-lang.org/issues/6532#change-26979 Author: prijutme4ty (Ilya Vorontsov) Status: Open Priority: Normal Assignee: Category: Target version: I suggest introducing Hash methods: has_all_keys?, has_any_key?, has_none_key?, has_one_key? to write: input.has_all_keys? %w{A C G T} instead of: %w{A C G T}.all?{|letter| input.has_key? letter} and to write args.has_one_key?(:input_file, :input_string, :input_from_another_source, ...) instead of obvious but verbose code with iterating through keys Also I suggest reimplement method Array#delete_at to work with multiple keys: def delete_at(*args) args.sort.reverse{|index| current_version_of_delete_at index} end It helps not only writing multiple deletion code faster but also prevents mistakes with deleting elements from an array in arbitrary order -- http://bugs.ruby-lang.org/