/lib/carrierwave/uploader/download.rb
http://github.com/jnicklas/carrierwave · Ruby · 24 lines · 14 code · 2 blank · 8 comment · 0 complexity · 814523594ca0390544b366a1f4388120 MD5 · raw file
- module CarrierWave
- module Uploader
- module Download
- extend ActiveSupport::Concern
- include CarrierWave::Uploader::Callbacks
- include CarrierWave::Uploader::Configuration
- include CarrierWave::Uploader::Cache
- ##
- # Caches the file by downloading it from the given URL, using downloader.
- #
- # === Parameters
- #
- # [url (String)] The URL where the remote file is stored
- # [remote_headers (Hash)] Request headers
- #
- def download!(uri, remote_headers = {})
- file = downloader.new(self).download(uri, remote_headers)
- cache!(file)
- end
- end # Download
- end # Uploader
- end # CarrierWave