Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.

Added a #merge method to the map classes. #34

Merged
merged 1 commit into from
May 15, 2015
Merged

Added a #merge method to the map classes. #34

merged 1 commit into from
May 15, 2015

Conversation

jdantonio
Copy link
Member

Addresses #8.

The new '#merge` method for the map classes has the same behavior as the same method on a Ruby hash, including the ability to pass a block. The return value is a new map with the appropriate values updated accordingly:

m = Ref::WeakKeyMap.new #=> {}
a = Object.new #=> #<Object:0x007fe072421ee0>
m[a] = "test" #=> "test"
n = m.merge(Object.new => "something") #=> {#<Object:0x007fe072421ee0>=>"test", #<Object:0x007fe072409250>=>"something"}

jdantonio added a commit that referenced this pull request May 15, 2015
Added a #merge method to the map classes.
@jdantonio jdantonio merged commit 72e2c12 into master May 15, 2015
@jdantonio jdantonio deleted the map-merge branch May 15, 2015 02:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant