Permalink
Browse files

slice now returns indifferent hash if called on one

Signed-off-by: Michael Koziarski <michael@koziarski.com>

[#1096 state:committed]

Conflicts:

	activesupport/lib/active_support/core_ext/hash/slice.rb
  • Loading branch information...
1 parent 57e45ad commit 3b9c2fdf9e1813b8317d529aeb4074806e14ade2 @NZKoz NZKoz committed Sep 23, 2008
Showing with 1 addition and 1 deletion.
  1. +1 −1 activesupport/lib/active_support/core_ext/hash/slice.rb
@@ -15,7 +15,7 @@ module Slice
# Returns a new hash with only the given keys.
def slice(*keys)
allowed = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys)
- hash = {}
+ hash = self.class.new
allowed.each { |k| hash[k] = self[k] if has_key?(k) }
hash
end

0 comments on commit 3b9c2fd

Please sign in to comment.