Permalink
Browse files

fixed so it work in Ruby 1.9.2 - cannot delete

a key while iterating
  • Loading branch information...
1 parent ac7be41 commit 962a273955de52fca5554da0acc7045c77095864 Anders Törnqvist committed Jun 16, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/resto/extra/assert_hash.rb
@@ -33,7 +33,7 @@ class AssertHash
def self.keys(hash, *valid_keys)
hash ||= {}
- hash.each { |key, value| hash[key.to_sym] = hash.delete(key) }
+ hash = hash.inject({}) { |h, (key, value)| h[key.to_sym] = hash.delete(key); h }
known_keys = [valid_keys].flatten
unknown_keys = hash.keys - known_keys

0 comments on commit 962a273

Please sign in to comment.