rails/rails — pull request #3770 by phuibonhoa (2011-11-27 11:57:05+00:00)
Title: Added assert_required_keys to Hash

assert_required_keys will raise an ArgumentError if the calling hash does not include every key passed to the method.

This hopefully will allow cleaner usage of hashes as a stand-in for named parameters.

```ruby
def deposit(options={})
options.assert_required_keys :account_number, :amount
...
end

deposit :amount => 100
# => ArgumentError: The following keys are required but were not set: :account_number
```