Permalink
Browse files

slice now returns indifferent hash if called on one

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

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

0 comments on commit 2e75bd0

Please sign in to comment.