ruby flatten only 1 level code example
Example: ruby flatten only 1 level
array.flatten(1)
[[1,2],3].flatten(1)
=> [1, 2, 3]
[[1,[2]],3].flatten(1)
=> [1, [2], 3]
array.flatten(1)
[[1,2],3].flatten(1)
=> [1, 2, 3]
[[1,[2]],3].flatten(1)
=> [1, [2], 3]