class Fontist::Utils::Downloader
Public Class Methods
download(*args)
click to toggle source
# File lib/fontist/utils/downloader.rb, line 7 def download(*args) new(*args).download end
new(file, file_size: nil, sha: nil, progress_bar: nil, use_content_length: true)
click to toggle source
# 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 = progress_bar @use_content_length = use_content_length @cache = Cache.new end
Public Instance Methods
download()
click to toggle source
# File lib/fontist/utils/downloader.rb, line 27 def download file = @cache.fetch(url) do download_file end check_tampered(file) file end