GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: Koz's rails git-svn clone
Homepage: http://www.rubyonrails.org
Clone URL: git://github.com/NZKoz/koz-rails.git
Revert [9209] Use Hash#except


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9210 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
pratik (author)
Wed Apr 02 05:47:52 -0700 2008
commit  05d27c7c4eb0f6d81058aa929be01b6812370bed
tree    093617bbe3cdf1b2338c88a23862ff556fd73198
parent  85a5daef19ca727e4f2120a850f64613034f9ecc
...
1
2
3
4
5
6
7
...
1
2
 
 
3
4
5
0
@@ -1,7 +1,5 @@
0
 *SVN*
0
 
0
-* Adding Hash#without Closes #7369 [eventualbuddha]
0
-
0
 * TimeWithZone#method_missing: send to utc to advance with dst correctness, otherwise send to time. Adding tests for time calculations methods [Geoff Buesing]
0
 
0
 * Add config.active_support.use_standard_json_time_format setting so that Times and Dates export to ISO 8601 dates. [rick]
...
11
12
13
14
15
16
17
18
19
20
21
...
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
...
11
12
13
 
 
 
 
 
14
15
16
...
22
23
24
 
 
 
 
 
 
 
 
 
 
 
25
26
27
0
@@ -11,11 +11,6 @@ module ActiveSupport #:nodoc:
0
       # end
0
       #
0
       # search(options.slice(:mass, :velocity, :time))
0
- #
0
- # Also allows leaving out certain keys. This is useful when duplicating
0
- # a hash but omitting a certain subset:
0
- #
0
- # Event.new(event.attributes.without(:id, :user_id))
0
       module Slice
0
         # Returns a new hash with only the given keys.
0
         def slice(*keys)
0
@@ -27,17 +22,6 @@ module ActiveSupport #:nodoc:
0
         def slice!(*keys)
0
           replace(slice(*keys))
0
         end
0
-
0
- # Returns a new hash without the given keys.
0
- def without(*keys)
0
- allowed = self.keys - (respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys)
0
- slice(*allowed)
0
- end
0
-
0
- # Replaces the hash without the given keys.
0
- def without!(*keys)
0
- replace(without(*keys))
0
- end
0
       end
0
     end
0
   end
...
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
...
310
311
312
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
314
315
0
@@ -310,38 +310,6 @@ class HashExtTest < Test::Unit::TestCase
0
     assert_equal expected, original.except!(:c)
0
     assert_equal expected, original
0
   end
0
-
0
- def test_without
0
- original = { :a => 'x', :b => 'y', :c => 10 }
0
- expected = { :a => 'x' }
0
-
0
- # Should return a hash without the given keys.
0
- assert_equal expected, original.without(:b, :c)
0
- assert_not_equal expected, original
0
-
0
- # Should ignore non-existant keys.
0
- assert_equal expected, original.without(:b, :c, :d)
0
-
0
- # Should replace the hash with the given keys taken away.
0
- assert_equal expected, original.without!(:b, :c)
0
- assert_equal expected, original
0
- end
0
-
0
- def test_indifferent_without
0
- original = { :a => 'x', :b => 'y', :c => 10 }.with_indifferent_access
0
- expected = { :c => 10 }.with_indifferent_access
0
-
0
- [['a', 'b'], [:a, :b]].each do |keys|
0
- # Should return a new hash without the given keys.
0
- assert_equal expected, original.without(*keys), keys.inspect
0
- assert_not_equal expected, original
0
-
0
- # Should replace the hash without the given keys.
0
- copy = original.dup
0
- assert_equal expected, copy.without!(*keys)
0
- assert_equal expected, copy
0
- end
0
- end
0
 end
0
 
0
 class IWriteMyOwnXML

Comments

    No one has commented yet.