Sha256: 82914f0b7ff42fed6a200371b41123f50af321f32921f496b25c6718e1eefdd7

Contents?: true

Size: 179 Bytes

Versions: 10

Compression:

Stored size: 179 Bytes

Contents

class Array

  # Simplify an array by flattening it then compacting it.
  #
  #   [1,[2,nil,[3]],nil,4].collapse  #=> [1,2,3,4]
  #
  def collapse
    flatten.compact
  end

end

Version data entries

10 entries across 9 versions & 1 rubygems

Version Path
facets-2.9.3 lib/core/facets/array/collapse.rb
facets-2.9.2 src/core/facets/array/collapse.rb
facets-2.9.2 lib/core/facets/array/collapse.rb
facets-2.9.1 lib/core/facets/array/collapse.rb
facets-2.9.0 lib/core/facets/array/collapse.rb
facets-2.9.0.pre.2 lib/core/facets/array/collapse.rb
facets-2.9.0.pre.1 lib/core/facets/array/collapse.rb
facets-2.8.4 lib/core/facets/enumerable/collapse.rb
facets-2.8.3 lib/core/facets/enumerable/collapse.rb
facets-2.8.2 lib/core/facets/enumerable/collapse.rb