Changeset 7172
- Timestamp:
- 07/09/07 21:49:37 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activesupport/CHANGELOG
r7092 r7172 1 1 *SVN* 2 3 * Added Hash#except which is the inverse of Hash#slice -- return the hash except the keys that are specified [DHH] 2 4 3 5 * Added support for pluralization with a different starting letter than the singular version (cow/kine) #4929 [norri_b/hasmanyjosh] trunk/activesupport/lib/active_support/core_ext/hash.rb
r5726 r7172 1 %w(keys indifferent_access reverse_merge conversions diff slice ).each do |ext|1 %w(keys indifferent_access reverse_merge conversions diff slice except).each do |ext| 2 2 require "#{File.dirname(__FILE__)}/hash/#{ext}" 3 3 end … … 10 10 include ActiveSupport::CoreExtensions::Hash::Diff 11 11 include ActiveSupport::CoreExtensions::Hash::Slice 12 include ActiveSupport::CoreExtensions::Hash::Except 12 13 end trunk/activesupport/test/core_ext/hash_ext_test.rb
r7074 r7172 277 277 assert_equal expected, copy 278 278 end 279 end 280 281 def test_except 282 original = { :a => 'x', :b => 'y', :c => 10 } 283 expected = { :a => 'x', :b => 'y' } 284 285 # Should return a new hash with only the given keys. 286 assert_equal expected, original.except(:c) 287 assert_not_equal expected, original 288 289 # Should replace the hash with only the given keys. 290 assert_equal expected, original.except!(:c) 291 assert_equal expected, original 279 292 end 280 293 end