Method: Array#collapse
- Defined in:
- lib/core/facets/array/collapse.rb
#collapse ⇒ Object
Simplify an array by flattening it then compacting it.
[1,[2,nil,[3]],nil,4].collapse #=> [1,2,3,4]
7 8 9 |
# File 'lib/core/facets/array/collapse.rb', line 7 def collapse flatten.compact end |