Sha256: b39d09767bbbfeb3e40d7f4eb3695c7792d1b3d411a8c63829f13f2554fdc742

Contents?: true

Size: 470 Bytes

Versions: 9

Compression:

Stored size: 470 Bytes

Contents

module Polyfill
  module V2_4
    module Enumerator
      module Lazy
        using Polyfill(Enumerable: %w[#chunk_while], version: '2.4')

        def chunk_while
          super.lazy
        end

        def uniq
          seen = Set.new

          ::Enumerator::Lazy.new(self) do |yielder, *values|
            result = block_given? ? yield(*values) : values

            yielder.<<(*values) if seen.add?(result)
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
polyfill-1.9.0 lib/polyfill/v2_4/enumerator/lazy.rb
polyfill-1.8.0 lib/polyfill/v2_4/enumerator/lazy.rb
polyfill-1.7.0 lib/polyfill/v2_4/enumerator/lazy.rb
polyfill-1.6.0 lib/polyfill/v2_4/enumerator/lazy.rb
polyfill-1.5.0 lib/polyfill/v2_4/enumerator/lazy.rb
polyfill-1.4.0 lib/polyfill/v2_4/enumerator/lazy.rb
polyfill-1.3.0 lib/polyfill/v2_4/enumerator/lazy.rb
polyfill-1.2.0 lib/polyfill/v2_4/enumerator/lazy.rb
polyfill-1.1.0 lib/polyfill/v2_4/enumerator/lazy.rb