← Reference

array-methods

Ruby array-methods reference.

Hash#flatten

Returns a new array that is a recursive flattening of self to the specified depth. Supports integer depth control, nil for full flatten, and negative values.

array.flatten(depth = nil)