Sha256: 5cc10f0a01bea0704f03f595a5cc809c4f209bb8d2aec521eea0826165345363
Contents?: true
Size: 579 Bytes
Versions: 1
Compression:
Stored size: 579 Bytes
Contents
# frozen_string_literal: true require "down" require "securerandom" module Miteru class Downloader attr_reader :url, :base_dir def initialize(url, base_dir = "/tmp") @url = url @base_dir = base_dir end def save_filename "#{SecureRandom.alphanumeric}.zip" end def destination @destination ||= "#{base_dir}/#{save_filename}" end def download Down.download(url, destination: destination) destination end def self.download(url, base_dir = "/tmp") new(url, base_dir).download end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
miteru-0.3.1 | lib/miteru/downloader.rb |