Class Gem::OldFormat
In: lib/rubygems/old_format.rb
Parent: Object

The format class knows the guts of the RubyGem .gem file format and provides the capability to read gem files

Methods

Attributes

file_entries  [RW] 
gem_path  [RW] 
spec  [RW] 

Public Class methods

Reads the named gem file and returns a Format object, representing the data from the gem file

file_path:[String] Path to the gem file

[Source]

    # File lib/rubygems/old_format.rb, line 36
36:     def self.from_file_by_path(file_path)
37:       unless File.exist?(file_path)
38:         raise Gem::Exception, "Cannot load gem file [#{file_path}]"
39:       end
40:       File.open(file_path, 'rb') do |file|
41:         from_io(file, file_path)
42:       end
43:     end

Reads a gem from an io stream and returns a Format object, representing the data from the gem file

io:[IO] Stream from which to read the gem

[Source]

    # File lib/rubygems/old_format.rb, line 51
51:     def self.from_io(io, gem_path="(io)")
52:       format = self.new(gem_path)
53:       skip_ruby(io)
54:       format.spec = read_spec(io)
55:       format.file_entries = []
56:       read_files_from_gem(io) do |entry, file_data|
57:         format.file_entries << [entry, file_data]
58:       end
59:       format
60:     end

Constructs an instance of a Format object, representing the gem‘s data structure.

gem:[String] The file name of the gem

[Source]

    # File lib/rubygems/old_format.rb, line 26
26:     def initialize(gem_path)
27:       @gem_path = gem_path
28:     end

[Validate]