Merge pull request #46942 from jonathanhefner/hwia-fetch_values-use-map-bang

Use `map!` in `HashWithIndifferentAccess#fetch_values`
This commit is contained in:
Jonathan Hefner 2023-01-09 17:00:27 -06:00 committed by GitHub
commit a2d179aa0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -247,7 +247,8 @@ def values_at(*keys)
# hash.fetch_values('a', 'c') { |key| 'z' } # => ["x", "z"]
# hash.fetch_values('a', 'c') # => KeyError: key not found: "c"
def fetch_values(*indices, &block)
super(*indices.map { |key| convert_key(key) }, &block)
indices.map! { |key| convert_key(key) }
super
end
# Returns a shallow copy of the hash.