Skip to content

Commit

Permalink
slice now returns indifferent hash if called on one
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Koziarski <michael@koziarski.com>

[rails#1096 state:committed]

Conflicts:

	activesupport/lib/active_support/core_ext/hash/slice.rb
  • Loading branch information
NZKoz committed Sep 23, 2008
1 parent 57e45ad commit 3b9c2fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activesupport/lib/active_support/core_ext/hash/slice.rb
Expand Up @@ -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
Expand Down

0 comments on commit 3b9c2fd

Please sign in to comment.