module Shrine::Plugins::RemoteUrl

  1. lib/shrine/plugins/remote_url.rb

Documentation lives in doc/plugins/remote_url.md on GitHub.

Methods

Public Class

  1. configure

Public Class methods

configure (uploader, opts = {})
[show source]
   # File lib/shrine/plugins/remote_url.rb
11 def self.configure(uploader, opts = {})
12   raise Error, "The :max_size option is required for remote_url plugin" if !opts.key?(:max_size) && !uploader.opts.key?(:remote_url_max_size)
13 
14   uploader.opts[:remote_url_downloader] = opts.fetch(:downloader, uploader.opts.fetch(:remote_url_downloader, :open_uri))
15   uploader.opts[:remote_url_max_size] = opts.fetch(:max_size, uploader.opts[:remote_url_max_size])
16   uploader.opts[:remote_url_error_message] = opts.fetch(:error_message, uploader.opts[:remote_url_error_message])
17 end