sonic-pi
https://github.com/sonic-pi-net/sonic-pi
C++
Code. Music. Live.
ActiveSupport::HashWithIndifferentAccess#update
Updates the receiver in-place, merging in the hash passed as argument:
hash_1 = ActiveSupport::HashWithIndifferentAccess.new
hash_1[:key] = 'value'
hash_2 = ActiveSupport::HashWithIndifferentAccess.new
hash_2[:key] = 'New Value!'
hash_1.update(hash_2) # => {"key"=>"New Value!"}
The argument can be either an
<tt>ActiveSupport::HashWithIndifferentAccess</tt> or a regular +Hash+.
In either case the merge respects the semantics of indifferent access.
If the argument is a regular hash with keys +:key+ and +"key"+ only one
of the values end up in the receiver, but which one is unspecified.
When given a block, the value for duplicated keys will be determined
by the result of invoking the block with the duplicated key, the value
in the receiver, and the value in +other_hash+. The rules for duplicated
keys follow the semantics of indifferent access:
hash_1[:key] = 10
hash_2['key'] = 12
hash_1.update(hash_2) { |key, old, new| old + new } # => {"key"=>22}Edit
git clone [email protected]:sonic-pi-net/sonic-pi.git
cd sonic-pi
open app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/hash_with_indifferent_access.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-ActiveSupport--HashWithIndifferentAccess-update-for-pr
# Commit to gitgit add app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/hash_with_indifferent_access.rbgit commit -m "better docs for ActiveSupport::HashWithIndifferentAccess#update"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-ActiveSupport--HashWithIndifferentAccess-update-for-pr
hub pull-request
# Celebrate!