From edab820d9ee5c18780e11752d46d7df73c820ddb Mon Sep 17 00:00:00 2001 From: Leo Cassarani Date: Mon, 3 Sep 2012 23:13:49 +0100 Subject: 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. --- activesupport/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'activesupport/CHANGELOG.md') 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. -- cgit v1.2.3