Actions
Feature #15123
closedEnumerable#compact proposal
Feature #15123:
Enumerable#compact proposal
Description
Hi!
While Enumerable does not provide #compact method, it requires changing code in some cases to substitute array with enumerator.
For example, to reduce memory usage it's usual to change large_array.map { to_heavy_object }.chained_methods to large_array.lazy.... However if chained_methods contains compact, this change will fail. Replacing compact with reject(&:nil?) fixes it.
What do you think about adding #compact to Enumerable?
Actions