Class: Gem::Package::FileSource
- Defined in:
 - lib/rubygems/package/file_source.rb
 
Overview
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`.
Instance Attribute Summary collapse
- 
  
    
      #path  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
:nodoc: all.
 
Instance Method Summary collapse
- 
  
    
      #initialize(path)  ⇒ FileSource 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of FileSource.
 - #present? ⇒ Boolean
 - #start ⇒ Object
 - #with_read_io(&block) ⇒ Object
 - #with_write_io(&block) ⇒ Object
 
Constructor Details
#initialize(path) ⇒ FileSource
Returns a new instance of FileSource.
      12 13 14  | 
    
      # File 'lib/rubygems/package/file_source.rb', line 12 def initialize(path) @path = path end  | 
  
Instance Attribute Details
#path ⇒ Object (readonly)
:nodoc: all
      10 11 12  | 
    
      # File 'lib/rubygems/package/file_source.rb', line 10 def path @path end  | 
  
Instance Method Details
#present? ⇒ Boolean
      20 21 22  | 
    
      # File 'lib/rubygems/package/file_source.rb', line 20 def present? File.exist? path end  | 
  
#start ⇒ Object
      16 17 18  | 
    
      # File 'lib/rubygems/package/file_source.rb', line 16 def start @start ||= File.read path, 20 end  | 
  
#with_read_io(&block) ⇒ Object
      28 29 30  | 
    
      # File 'lib/rubygems/package/file_source.rb', line 28 def with_read_io(&block) File.open path, "rb", &block end  | 
  
#with_write_io(&block) ⇒ Object
      24 25 26  | 
    
      # File 'lib/rubygems/package/file_source.rb', line 24 def with_write_io(&block) File.open path, "wb", &block end  |