Skip to content
Permalink
Browse files

Merge pull request #709 from kostya/hash_replace

fix Hash#replace
  • Loading branch information
alex committed May 17, 2013
2 parents 5b94f7c + fecee05 commit f73e5eda6d4018c6d3f2a25d1545e9794f346469
@@ -1,6 +1 @@
fails:Hash#initialize_copy is private
fails:Hash#initialize_copy tries to convert the passed argument to a hash using #to_hash
fails:Hash#initialize_copy calls to_hash on hash subclasses
fails:Hash#initialize_copy does not transfer default values
fails:Hash#initialize_copy raises a RuntimeError if called on a frozen instance that is modified
fails:Hash#initialize_copy raises a RuntimeError if called on a frozen instance that would not be modified

This file was deleted.

@@ -118,9 +118,12 @@ def method_shift(self, space):
@classdef.method("replace")
@check_frozen()
def method_replace(self, space, w_hash):
w_hash = space.convert_type(w_hash, space.w_hash, "to_hash")
assert isinstance(w_hash, W_HashObject)
self.contents.clear()
self.contents.update(w_hash.contents)
self.w_default = w_hash.w_default
self.default_proc = w_hash.default_proc
return self

@classdef.method("keys")

0 comments on commit f73e5ed

Please sign in to comment.