aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/CHANGELOG.md
diff options
context:
space:
mode:
authorLeo Cassarani <leo.cassarani@me.com>2012-09-03 23:13:49 +0100
committerLeo Cassarani <leo.cassarani@me.com>2012-09-05 00:59:29 +0100
commitedab820d9ee5c18780e11752d46d7df73c820ddb (patch)
treefbe62a00a861fc9fcd1338b48df9df96da4e3c0e /activesupport/CHANGELOG.md
parent7995c03dc0e8ff8448427de16c98f77aa8bb6a01 (diff)
downloadrails-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/CHANGELOG.md')
-rw-r--r--activesupport/CHANGELOG.md6
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 8dd88f9f62..761780fb8b 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -1,5 +1,11 @@
## Rails 4.0.0 (unreleased) ##
+* An optional block can be passed to `HashWithIndifferentAccess#update` and `#merge`.
+ The block will be invoked for each duplicated key, and used to resolve the conflict,
+ thus replicating the behaviour of the corresponding methods on the `Hash` class.
+
+ *Leo Cassarani*
+
* Remove `j` alias for `ERB::Util#json_escape`.
The `j` alias is already used for `ActionView::Helpers::JavaScriptHelper#escape_javascript`
and both modules are included in the view context that would confuse the developers.