Merge pull request #46942 from jonathanhefner/hwia-fetch_values-use-map-bang
Use `map!` in `HashWithIndifferentAccess#fetch_values`
This commit is contained in:
commit
a2d179aa0c
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user