Sha256: 873e6fda8d3720ae47b62138c866e821b2ae21f9b0ad9377ba8d5bc12bc5f863

Contents?: true

Size: 260 Bytes

Versions: 3

Compression:

Stored size: 260 Bytes

Contents

# frozen_string_literal: true

module Refinements
  # Refinements for Arrays.
  module ArrayExtensions
    refine Array do
      def compress
        compact.reject(&:empty?)
      end

      def compress!
        replace(compress)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
refinements-2.2.1 lib/refinements/array_extensions.rb
refinements-2.2.0 lib/refinements/array_extensions.rb
refinements-2.1.0 lib/refinements/array_extensions.rb