Sha256: 99bb48b2c8c0cc3e44268b7dc2297dfadb3580faf78078ce1851f3e6d7c713a7

Contents?: true

Size: 722 Bytes

Versions: 31

Compression:

Stored size: 722 Bytes

Contents

# frozen_string_literal: true

module Gem
  # The Gem::List class is currently unused and will be removed in the next major rubygems version
  class List # :nodoc:
    include Enumerable
    attr_accessor :value, :tail

    def initialize(value = nil, tail = nil)
      @value = value
      @tail = tail
    end

    def each
      n = self
      while n
        yield n.value
        n = n.tail
      end
    end

    def to_a
      super.reverse
    end

    def prepend(value)
      List.new value, self
    end

    def pretty_print(q) # :nodoc:
      q.pp to_a
    end

    def self.prepend(list, value)
      return List.new(value) unless list
      List.new value, list
    end
  end
  deprecate_constant :List
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
malicious-1.1 lib/rubygems/util/list.rb
rubygems-update-3.6.6 lib/rubygems/util/list.rb
rubygems-update-3.6.5 lib/rubygems/util/list.rb
rubygems-update-3.6.4 lib/rubygems/util/list.rb
rubygems-update-3.6.3 lib/rubygems/util/list.rb
rubygems-update-3.6.2 lib/rubygems/util/list.rb
rubygems-update-3.6.1 lib/rubygems/util/list.rb
rubygems-update-3.6.0 lib/rubygems/util/list.rb
rubygems-update-3.5.23 lib/rubygems/util/list.rb
rubygems-update-3.5.22 lib/rubygems/util/list.rb
rubygems-update-3.5.21 lib/rubygems/util/list.rb
rubygems-update-3.5.20 lib/rubygems/util/list.rb
rubygems-update-3.5.19 lib/rubygems/util/list.rb
rubygems-update-3.5.18 lib/rubygems/util/list.rb
rubygems-update-3.5.17 lib/rubygems/util/list.rb
rubygems-update-3.5.16 lib/rubygems/util/list.rb
rubygems-update-3.5.15 lib/rubygems/util/list.rb
rubygems-update-3.5.14 lib/rubygems/util/list.rb
rubygems-update-3.5.13 lib/rubygems/util/list.rb
rubygems-update-3.5.12 lib/rubygems/util/list.rb