Sha256: 88646b4705efd9719e84421bdd85c202f78c05f88a19d83bc36dffcdb2a2971e

Contents?: true

Size: 769 Bytes

Versions: 21

Compression:

Stored size: 769 Bytes

Contents

# frozen_string_literal: true
##
# Supports reading and writing gems from/to a generic IO object.  This is
# useful for other applications built on top of rubygems, such as
# rubygems.org.
#
# This is a private class, do not depend on it directly. Instead, pass an IO
# object to `Gem::Package.new`.

class Gem::Package::IOSource < Gem::Package::Source # :nodoc: all

  attr_reader :io

  def initialize(io)
    @io = io
  end

  def start
    @start ||= begin
      if io.pos > 0
        raise Gem::Package::Error, "Cannot read start unless IO is at start"
      end

      value = io.read 20
      io.rewind
      value
    end
  end

  def present?
    true
  end

  def with_read_io
    yield io
  end

  def with_write_io
    yield io
  end

  def path
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
rubygems-update-3.1.6 lib/rubygems/package/io_source.rb
rubygems-update-3.1.5 lib/rubygems/package/io_source.rb
rubygems-update-3.0.9 lib/rubygems/package/io_source.rb
rubygems-update-3.2.0.rc.1 lib/rubygems/package/io_source.rb
rubygems-update-3.1.4 lib/rubygems/package/io_source.rb
rubygems-update-3.1.3 lib/rubygems/package/io_source.rb
rubygems-update-3.0.8 lib/rubygems/package/io_source.rb
rubygems-update-3.0.7 lib/rubygems/package/io_source.rb
rubygems-update-3.1.2 lib/rubygems/package/io_source.rb
rubygems-update-3.1.1 lib/rubygems/package/io_source.rb
rubygems-update-3.1.0 lib/rubygems/package/io_source.rb
rubygems-update-3.1.0.pre3 lib/rubygems/package/io_source.rb
rubygems-update-3.1.0.pre2 lib/rubygems/package/io_source.rb
rubygems-update-3.1.0.pre1 lib/rubygems/package/io_source.rb
rubygems-update-3.0.6 lib/rubygems/package/io_source.rb
rubygems-update-3.0.5 lib/rubygems/package/io_source.rb
rubygems-update-3.0.4 lib/rubygems/package/io_source.rb
rubygems-update-3.0.3 lib/rubygems/package/io_source.rb
rubygems-update-3.0.2 lib/rubygems/package/io_source.rb
rubygems-update-3.0.1 lib/rubygems/package/io_source.rb