Skip to content

Commit

Permalink
[ci skip] fix doc for the Hash#assert_valid_keys
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya Kapoor authored and Zachary Scott committed Jun 17, 2014
1 parent f42f603 commit b81f364
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions activesupport/lib/active_support/core_ext/hash/keys.rb
Expand Up @@ -57,9 +57,9 @@ def symbolize_keys!
end end
alias_method :to_options!, :symbolize_keys! alias_method :to_options!, :symbolize_keys!


# Validate all keys in a hash match <tt>*valid_keys</tt>, raising ArgumentError # Ensures all the hash's keys are present in the supplied list of <tt>*valid_keys</tt>.
# on a mismatch. Note that keys are NOT treated indifferently, meaning if you # Raises an ArgumentError if any unexpected keys are encountered.
# use strings for keys but assert symbols as keys, this will fail. # 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', 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'" # { name: 'Rob', age: '28' }.assert_valid_keys('name', 'age') # => raises "ArgumentError: Unknown key: :name. Valid keys are: 'name', 'age'"
Expand Down

0 comments on commit b81f364

Please sign in to comment.