diff options
author | Zachary Scott <e@zzak.io> | 2014-06-17 14:13:02 -0700 |
---|---|---|
committer | Zachary Scott <e@zzak.io> | 2014-06-17 14:13:02 -0700 |
commit | 9f86780226c86fae30d59d04bd53449b8c7a1ad8 (patch) | |
tree | 81408ee67aeda4af3712d76b998ee03b57ffe67c | |
parent | b81f36490537ec6f2f234588919db53b67ec981a (diff) | |
download | rails-9f86780226c86fae30d59d04bd53449b8c7a1ad8.tar.gz rails-9f86780226c86fae30d59d04bd53449b8c7a1ad8.tar.bz2 rails-9f86780226c86fae30d59d04bd53449b8c7a1ad8.zip |
Fix documentation from #15669 [ci skip]
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/keys.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/keys.rb b/activesupport/lib/active_support/core_ext/hash/keys.rb index 3d1fb8e8ee..8657f34be2 100644 --- a/activesupport/lib/active_support/core_ext/hash/keys.rb +++ b/activesupport/lib/active_support/core_ext/hash/keys.rb @@ -57,9 +57,11 @@ class Hash end alias_method :to_options!, :symbolize_keys! - # Ensures all the hash's keys are present in the supplied list of <tt>*valid_keys</tt>. - # Raises an ArgumentError if any unexpected keys are encountered. - # Note that keys are NOT treated indifferently: strings and symbols will not match each other. + # Validate all keys in a hash match <tt>*valid_keys</tt>, raising + # ArgumentError on a mismatch. + # + # Note that keys are treated differently than HashWithIndifferentAccess, + # meaning that string and symbol keys will not match. # # { name: 'Rob', years: '28' }.assert_valid_keys(:name, :age) # => raises "ArgumentError: Unknown key: :years. Valid keys are: :name, :age" # { name: 'Rob', age: '28' }.assert_valid_keys('name', 'age') # => raises "ArgumentError: Unknown key: :name. Valid keys are: 'name', 'age'" |