method

flatten!

v1_8_7_72 - Show latest stable - Class: Array
flatten!(...)
public

Flattens self in place. Returns nil if no modifications were made (i.e., array contains no subarrays.) If the optional level argument determines the level of recursion to flatten.

   a = [ 1, 2, [3, [4, 5] ] ]
   a.flatten!   #=> [1, 2, 3, 4, 5]
   a.flatten!   #=> nil
   a            #=> [1, 2, 3, 4, 5]
   a = [ 1, 2, [3, [4, 5] ] ]
   a.flatten!(1) #=> [1, 2, 3, [4, 5]]