sonic-pi

https://github.com/sonic-pi-net/sonic-pi

C++

Code. Music. Live.

Hamster::Associable#update_in

Return a new container with a deeply nested value modified to the result
of the given code block.  When traversing the nested containers
non-existing keys are created with empty `Hash` values.

The code block receives the existing value of the deeply nested key/index
(or `nil` if it doesn't exist). This is useful for "transforming" the
value associated with a certain key/index.

Naturally, the original container and sub-containers are left unmodified;
new data structure copies are created along the path as needed.

Source | Google | Stack overflow

Edit

git clone [email protected]:sonic-pi-net/sonic-pi.git

cd sonic-pi

open app/server/ruby/vendor/hamster-3.0.0/lib/hamster/associable.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Hamster--Associable-update_in-for-pr


# Commit to git

git add app/server/ruby/vendor/hamster-3.0.0/lib/hamster/associable.rbgit commit -m "better docs for Hamster::Associable#update_in"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Hamster--Associable-update_in-for-pr

hub pull-request


# Celebrate!