Sha256: 10dc488f48abc7b02cecfbec61a15fae7b0d70fbbb60a5f39670309f0fa3632c

Contents?: true

Size: 304 Bytes

Versions: 6

Compression:

Stored size: 304 Bytes

Contents

# frozen_string_literal: true

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

      def compress!
        replace compress
      end

      def ring &block
        [last, *self, first].each_cons 3, &block
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
refinements-7.7.0 lib/refinements/arrays.rb
refinements-7.6.0 lib/refinements/arrays.rb
refinements-7.5.0 lib/refinements/arrays.rb
refinements-7.4.0 lib/refinements/arrays.rb
refinements-7.3.0 lib/refinements/arrays.rb
refinements-7.2.0 lib/refinements/arrays.rb