Module: Imagemaster3000::Entities::Downloadable
- Included in:
- Image
- Defined in:
- lib/imagemaster3000/entities/downloadable.rb
Instance Method Summary collapse
Instance Method Details
#download ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/imagemaster3000/entities/downloadable.rb', line 6 def download logger.debug "Downloading image from #{url.inspect}" uri = URI.parse url filename = generate_filename(uri) retrieve_image(uri, filename) logger.debug "Image from #{url.inspect} was saved as #{filename.inspect}" @file = filename @size = File.size filename rescue ::URI::InvalidURIError, ::IOError => ex raise Imagemaster3000::Errors::DownloadError, ex end |