deep_enumerable
deep_enumerable copied to clipboard
A library for manipulating nested collections in Ruby
Unfortunately, [creating blocks in MRI is still very expensive](https://www.omniref.com/ruby/2.2.0/symbols/Proc/yield?#annotation=4087638&line=711&hn=1), and you seem to pass around blocks quite a bit in this library. I could see this lib being used in...
Right now we duck-type against the name of the individual method, it would be good to encapsulate this, so the logic didn't need to be reproduced for each different method...
That works for Array as well as Hash [1, 2].shallow_merge({1 => 3, 2 => 4}) == [1, 3, 4] [1, 2].shallow_merge([nil, 3, 4]) == [1, 3, 4] // If we...
Factor out the commonalities
Maybe something like: dispatch_block(block, key, value) that calls block.call(key, value) or block.call(value) as appropriate