Implement Hash#replace