Permalink
Browse files

Merge pull request #1109 from dlee/optimize_indifferent_access

Use dup to preserve previous behavior
  • Loading branch information...
2 parents b13d24e + 96acdfb commit a921cab621cb6932f6e88979f7c6650d3c5952b2 @josevalim josevalim committed May 18, 2011
@@ -11,7 +11,7 @@ def extractable_options?
end
def with_indifferent_access
- self
+ dup
end
def initialize(constructor = {})
@@ -971,9 +971,10 @@ def test_should_nil_if_no_default_value_is_supplied
assert_nil hash_wia.default
end
- def test_should_return_self_for_with_indifferent_access
+ def test_should_return_dup_for_with_indifferent_access
hash_wia = HashWithIndifferentAccess.new
assert_equal hash_wia, hash_wia.with_indifferent_access
+ assert_not_same hash_wia, hash_wia.with_indifferent_access
end
def test_should_copy_the_default_value_when_converting_to_hash_with_indifferent_access

0 comments on commit a921cab

Please sign in to comment.