Class: Fontist::Utils::Downloader
- Inherits:
 - 
      Object
      
        
- Object
 - Fontist::Utils::Downloader
 
 
- Defined in:
 - lib/fontist/utils/downloader.rb
 
Class Method Summary collapse
Instance Method Summary collapse
- #download ⇒ Object
 - 
  
    
      #initialize(file, file_size: nil, sha: nil, progress_bar: nil, use_content_length: true)  ⇒ Downloader 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Downloader.
 
Constructor Details
#initialize(file, file_size: nil, sha: nil, progress_bar: nil, use_content_length: true) ⇒ Downloader
Returns a new instance of Downloader.
      13 14 15 16 17 18 19 20 21 22 23 24 25  | 
    
      # File 'lib/fontist/utils/downloader.rb', line 13 def initialize(file, file_size: nil, sha: nil, progress_bar: nil, use_content_length: true) # TODO: If the first mirror fails, try the second one @file = file @sha = [sha].flatten.compact @file_size = file_size.to_i if file_size @progress_bar = @use_content_length = use_content_length @cache = Cache.new end  | 
  
Class Method Details
.download(*args) ⇒ Object
      7 8 9  | 
    
      # File 'lib/fontist/utils/downloader.rb', line 7 def download(*args) new(*args).download end  | 
  
Instance Method Details
#download ⇒ Object
      27 28 29 30 31 32 33 34 35  | 
    
      # File 'lib/fontist/utils/downloader.rb', line 27 def download file = @cache.fetch(url) do download_file end check_tampered(file) file end  |