method
fetch_values

fetch_values(*args)
public
Returns an array containing the values associated with the given keys but also raises KeyError when one of keys can’t be found. Also see Hash#values_at and Hash#fetch.
h = { "cat" => "feline", "dog" => "canine", "cow" => "bovine" } h.fetch_values("cow", "cat") #=> ["bovine", "feline"] h.fetch_values("cow", "bird") # raises KeyError h.fetch_values("cow", "bird") { |k| k.upcase } #=> ["bovine", "BIRD"]