Popularity
0.7
Stable
Activity
0.0
Stable
31
1
3

Description

A C extension alternative to using flatten.compact or flatten.map. Slight performance improvement (just a constant factor better) than the common idioms, with exactly the same memory performance.

See this blog post for the background and a chart of memory performance.

In addition, collapse makes two other slightly different choices from core Ruby's flatten. 1. Attempting to flatten a recursive Array will error normally. collapse just drops the recursive reference, and continues on its merry way. 2. collapse doesn't accept a level argument. It's all or nothing.

Monthly Downloads: 36
Programming language: Ruby
License: MIT License
Tags: Core Extensions     Performance     Array     Flatten    

Array#collapse alternatives and similar gems

Based on the "Core Extensions" category

Do you think we are missing an alternative of Array#collapse or a related project?

Add another 'Core Extensions' Gem