File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,9 +11,8 @@ def except(*items)
1111 # Similar to except but modifies self
1212 #
1313 def except! ( *keys )
14- copy = self . dup
15- keys . each { |key | copy . delete! ( key ) }
16- copy
14+ keys . each { |key | delete ( key ) }
15+ self
1716 end unless method_defined? :except!
1817
1918 # Returns a new hash with all the keys converted to symbols
Original file line number Diff line number Diff line change 1515 context '#except!' do
1616 it "should respond to except!" do
1717 @nested_hash . should respond_to :except!
18+ copy = @nested_hash . dup
19+ copy . except! ( 'b' , 'a' )
20+ copy . should be_empty
1821 end
1922 end
2023
Original file line number Diff line number Diff line change @@ -99,11 +99,3 @@ def reset_authentication_for(object)
9999 object . send ( "#{ item } =" , nil )
100100 end
101101end
102-
103- class Hash
104- def except ( *keys )
105- cpy = self . dup
106- keys . each { |key | cpy . delete ( key ) }
107- cpy
108- end
109- end
You can’t perform that action at this time.
0 commit comments