slice now returns indifferent hash if called on one

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

[#1096 state:committed]
This commit is contained in:
adam 2008-09-23 12:08:24 +02:00 committed by Michael Koziarski
parent c452e49e76
commit 2e75bd0808

@ -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