diff options
author | Leo Cassarani <leo.cassarani@me.com> | 2012-09-03 23:13:49 +0100 |
---|---|---|
committer | Leo Cassarani <leo.cassarani@me.com> | 2012-09-05 00:59:29 +0100 |
commit | edab820d9ee5c18780e11752d46d7df73c820ddb (patch) | |
tree | fbe62a00a861fc9fcd1338b48df9df96da4e3c0e /activesupport/test/core_ext/class_test.rb | |
parent | 7995c03dc0e8ff8448427de16c98f77aa8bb6a01 (diff) | |
download | rails-edab820d9ee5c18780e11752d46d7df73c820ddb.tar.gz rails-edab820d9ee5c18780e11752d46d7df73c820ddb.tar.bz2 rails-edab820d9ee5c18780e11752d46d7df73c820ddb.zip |
Extend HashWithIndifferentAccess#update to take an optional block
When a block is passed into the method, it will be invoked for each
duplicated key, with the key in question and the two values as
arguments. The value for the duplicated key in the receiver will
be set to the return value of the block.
This behaviour matches Ruby's long-standing implementation of
Hash#update and is intended to provide a more consistent interface.
HashWithIndifferentAccess#merge is also affected by the change, as it
uses #update internally.
Diffstat (limited to 'activesupport/test/core_ext/class_test.rb')
0 files changed, 0 insertions, 0 deletions