sonic-pi

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

C++

Code. Music. Live.

Hamster::Hash#put

Return a new `Hash` with the existing key/value associations, plus an association
between the provided key and value. If an equivalent key is already present, its
associated value will be replaced with the provided one.

If the `value` argument is missing, but an optional code block is provided,
it will be passed the existing value (or `nil` if there is none) and what it
returns will replace the existing value. This is useful for "transforming"
the value associated with a certain key.

Avoid mutating objects which are used as keys. `String`s are an exception:
unfrozen `String`s which are used as keys are internally duplicated and
frozen. This matches RubyHash's behaviour.

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/hash.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Hamster--Hash-put-for-pr


# Commit to git

git add app/server/ruby/vendor/hamster-3.0.0/lib/hamster/hash.rbgit commit -m "better docs for Hamster::Hash#put"


# 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--Hash-put-for-pr

hub pull-request


# Celebrate!