public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Performance: speed up Hash#except.  [#382 state:resolved]
granth (author)
Tue Jun 10 08:54:58 -0700 2008
jeremy (committer)
Wed Jun 11 00:47:02 -0700 2008
commit  634e462a0b70ddae2f21dbddddd07e7b340bb69c
tree    1bdddcac017c4bcd328ae4e97fd1e9a8ef4c6dad
parent  e8a0ba4c93e2f0f811675bc6a6720725c866d1a5
...
10
11
12
13
14
 
15
16
17
18
19
 
 
 
20
21
22
...
10
11
12
 
 
13
14
15
16
17
 
18
19
20
21
22
23
0
@@ -10,13 +10,14 @@ module ActiveSupport #:nodoc:
0
       module Except
0
         # Returns a new hash without the given keys.
0
         def except(*keys)
0
- rejected = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys)
0
- reject { |key,| rejected.include?(key) }
0
+ clone.except!(*keys)
0
         end
0
 
0
         # Replaces the hash without only the given keys.
0
         def except!(*keys)
0
- replace(except(*keys))
0
+ keys.map! { |key| convert_key(key) } if respond_to?(:convert_key)
0
+ keys.each { |key| delete(key) }
0
+ self
0
         end
0
       end
0
     end

Comments

    No one has commented yet.