# File lib/active_support/core_ext/hash/slice.rb, line 16 def slice(*keys) allowed = Set.new(respond_to?(:convert_key) ? keys.map { |key| convert_key(key) } : keys) hash = self.class.new allowed.each { |k| hash[k] = self[k] if has_key?(k) } hash end