Sha256: d49b0a9a45187a920ca365da11ae71dc8627b42c97fafa811e42830fea0cc71d

Contents?: true

Size: 611 Bytes

Versions: 21

Compression:

Stored size: 611 Bytes

Contents

# frozen_string_literal: true
##
# The primary source of gems is a file on disk, including all usages
# internal to rubygems.
#
# This is a private class, do not depend on it directly. Instead, pass a path
# object to `Gem::Package.new`.

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

  attr_reader :path

  def initialize(path)
    @path = path
  end

  def start
    @start ||= File.read path, 20
  end

  def present?
    File.exist? path
  end

  def with_write_io(&block)
    File.open path, 'wb', &block
  end

  def with_read_io(&block)
    File.open path, 'rb', &block
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

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