Extended maintenance of Ruby versions 1.8.7 and 1.9.2 will end on July 31, 2014. Read more

In Files

  • rubygems/old_format.rb

Parent

Class/Module Index [+]

Quicksearch

Gem::OldFormat

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

Attributes

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

Public Class Methods

from_file_by_path(file_path) click to toggle source

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

 
               # File rubygems/old_format.rb, line 36
def self.from_file_by_path(file_path)
  unless File.exist?(file_path)
    raise Gem::Exception, "Cannot load gem file [#{file_path}]"
  end

  File.open(file_path, 'rb') do |file|
    from_io(file, file_path)
  end
end
            
from_io(io, gem_path="(io)") click to toggle source

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

 
               # File rubygems/old_format.rb, line 52
def self.from_io(io, gem_path="(io)")
  format = self.new(gem_path)
  skip_ruby(io)
  format.spec = read_spec(io)
  format.file_entries = []
  read_files_from_gem(io) do |entry, file_data|
    format.file_entries << [entry, file_data]
  end
  format
end
            
new(gem_path) click to toggle source

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

gem
String

The file name of the gem

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

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus