rails

https://github.com/rails/rails

Ruby

Ruby on Rails

ActiveSupport::HashWithIndifferentAccess#fetch_values

Returns an array of the values at the specified indices, but also
raises an exception when one of the keys can't be found.

  hash = ActiveSupport::HashWithIndifferentAccess.new
  hash[:a] = 'x'
  hash[:b] = 'y'
  hash.fetch_values('a', 'b') # => ["x", "y"]
  hash.fetch_values('a', 'c') { |key| 'z' } # => ["x", "z"]
  hash.fetch_values('a', 'c') # => KeyError: key not found: "c"

Source | Google | Stack overflow

Edit

git clone [email protected]:rails/rails.git

cd rails

open activesupport/lib/active_support/hash_with_indifferent_access.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-ActiveSupport--HashWithIndifferentAccess-fetch_values-for-pr


# Commit to git

git add activesupport/lib/active_support/hash_with_indifferent_access.rbgit commit -m "better docs for ActiveSupport::HashWithIndifferentAccess#fetch_values"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-ActiveSupport--HashWithIndifferentAccess-fetch_values-for-pr

hub pull-request


# Celebrate!