aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorAditya Kapoor <aditya.kapoor@vinsol.com>2014-06-13 11:56:45 +0530
committerZachary Scott <e@zzak.io>2014-06-17 14:10:46 -0700
commitb81f36490537ec6f2f234588919db53b67ec981a (patch)
treecf5b5b042a6e3bf76f21af4cb0854019698ff31c /activesupport
parentf42f603d8a4ab54b4b3866a6a747880c46467da1 (diff)
downloadrails-b81f36490537ec6f2f234588919db53b67ec981a.tar.gz
rails-b81f36490537ec6f2f234588919db53b67ec981a.tar.bz2
rails-b81f36490537ec6f2f234588919db53b67ec981a.zip
[ci skip] fix doc for the Hash#assert_valid_keys
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/hash/keys.rb6
1 files changed, 3 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 5934c578ea..3d1fb8e8ee 100644
--- a/activesupport/lib/active_support/core_ext/hash/keys.rb
+++ b/activesupport/lib/active_support/core_ext/hash/keys.rb
@@ -57,9 +57,9 @@ class Hash
end
alias_method :to_options!, :symbolize_keys!
- # Validate all keys in a hash match <tt>*valid_keys</tt>, raising ArgumentError
- # on a mismatch. Note that keys are NOT treated indifferently, meaning if you
- # use strings for keys but assert symbols as keys, this will fail.
+ # 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.
#
# { 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'"