Sha256: 894b38eb457c0009dd1ab951a84a4b0a31e5fa997c016a187e326eb0094e99a2

Contents?: true

Size: 251 Bytes

Versions: 3

Compression:

Stored size: 251 Bytes

Contents

# frozen_string_literal: true

module Refinements
  # Refinements for arrays.
  module Arrays
    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-6.1.0 lib/refinements/arrays.rb
refinements-6.0.0 lib/refinements/arrays.rb
refinements-5.2.0 lib/refinements/arrays.rb