[ruby-core:76941] [Ruby trunk Bug#12682][Rejected] Hash#flatten(level) does not recursively flatten inner hashes.
From:
ruby-core@...
Date:
2016-08-17 01:40:33 UTC
List:
ruby-core #76941
Issue #12682 has been updated by Marc-Andre Lafortune.
Status changed from Open to Rejected
The documentation of `Array#flatten` is pretty clear:
"...That is, for every element that is an **array**, extract its elements into the new array."
So it follows the documentation and would create massive incompatibilities to change!
----------------------------------------
Bug #12682: Hash#flatten(level) does not recursively flatten inner hashes.
https://bugs.ruby-lang.org/issues/12682#change-60169
* Author: Kristine Robison
* Status: Rejected
* Priority: Normal
* Assignee:
* ruby -v: 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
~~~
pry
[1] pry(main)> x = {a: {b: 1, c:2}}
=> {:a=>{:b=>1, :c=>2}}
[2] pry(main)> x.flatten(1)
=> [:a, {:b=>1, :c=>2}]
[3] pry(main)> x.flatten(2)
=> [:a, {:b=>1, :c=>2}]
~~~
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>