diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-01-02 09:01:19 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-01-02 09:01:19 +0000 |
commit | 9def906fd05d120312223d0d9bc565cc2972f85a (patch) | |
tree | f614b2933d249bd89de43a5222ddd353b38c6527 /activesupport/lib | |
parent | 072b9d9fba2f1268a3b66de32eb6033124960f92 (diff) | |
download | rails-9def906fd05d120312223d0d9bc565cc2972f85a.tar.gz rails-9def906fd05d120312223d0d9bc565cc2972f85a.tar.bz2 rails-9def906fd05d120312223d0d9bc565cc2972f85a.zip |
Correct Hash#assert_valid_keys docs. Closes #10621 [Cheah Chu Yeow, blackanger]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8521 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/keys.rb | 7 |
1 files changed, 4 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 f104989df5..ff8e68faa1 100644 --- a/activesupport/lib/active_support/core_ext/hash/keys.rb +++ b/activesupport/lib/active_support/core_ext/hash/keys.rb @@ -38,11 +38,12 @@ module ActiveSupport #:nodoc: alias_method :to_options!, :symbolize_keys! # Validate all keys in a hash match *valid keys, raising ArgumentError on a mismatch. - # Note that keys are NOT treated indifferently, meaning if you use strings for keys but assert symbol + # Note that keys are NOT treated indifferently, meaning if you use strings for keys but assert symbols # as keys, this will fail. - # examples: + # + # ==== Examples: # { :name => "Rob", :years => "28" }.assert_valid_keys(:name, :age) # => raises "ArgumentError: Unknown key(s): years" - # { :name => "Rob", :age => "28" }.assert_valid_keys("name", "age") # => raises "ArgumentError: Unknown key(s): years, name" + # { :name => "Rob", :age => "28" }.assert_valid_keys("name", "age") # => raises "ArgumentError: Unknown key(s): name, age" # { :name => "Rob", :age => "28" }.assert_valid_keys(:name, :age) # => passes, raises nothing def assert_valid_keys(*valid_keys) unknown_keys = keys - [valid_keys].flatten |