Sha256: 020ae62aece486945a83822d2dd7d950635adabb05cfd1632a5f4ccc699a6e6e

Contents?: true

Size: 208 Bytes

Versions: 10

Compression:

Stored size: 208 Bytes

Contents

# frozen_string_literal: true

module ::Enumerable
  def map_compact
    result = []
    each do |item|
      selected = yield(item)
      result << selected unless selected.nil?
    end
    result
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
invoca-utils-0.6.0 lib/invoca/utils/map_compact.rb
invoca-utils-0.5.1 lib/invoca/utils/map_compact.rb
invoca-utils-0.5.0 lib/invoca/utils/map_compact.rb
invoca-utils-0.4.1 lib/invoca/utils/map_compact.rb
invoca-utils-0.4.0 lib/invoca/utils/map_compact.rb
invoca-utils-0.3.0 lib/invoca/utils/map_compact.rb
invoca-utils-0.2.0 lib/invoca/utils/map_compact.rb
invoca-utils-0.2.0.pre.1 lib/invoca/utils/map_compact.rb
invoca-utils-0.1.1 lib/invoca/utils/map_compact.rb
invoca-utils-0.1.0 lib/invoca/utils/map_compact.rb