Documentation can be found on shrinerb.com/docs/plugins/remote_url
Classes and Modules
Constants
DOWNLOADER | = | -> (url, **options) { Down.download(url, **options) } | ||
LOG_SUBSCRIBER | = | -> (event) do Shrine.logger.info "Remote URL (#{event.duration}ms) – #{{ remote_url: event[:remote_url], download_options: event[:download_options], uploader: event[:uploader], }.inspect}" end |
Public Class methods
configure(uploader, log_subscriber: LOG_SUBSCRIBER, **opts)
[show source]
# File lib/shrine/plugins/remote_url.rb 25 def self.configure(uploader, log_subscriber: LOG_SUBSCRIBER, **opts) 26 uploader.opts[:remote_url] ||= { downloader: DOWNLOADER } 27 uploader.opts[:remote_url].merge!(opts) 28 29 unless uploader.opts[:remote_url].key?(:max_size) 30 fail Error, "The :max_size option is required for remote_url plugin" 31 end 32 33 # instrumentation plugin integration 34 uploader.subscribe(:remote_url, &log_subscriber) if uploader.respond_to?(:subscribe) 35 end
load_dependencies(uploader, *)
[show source]
# File lib/shrine/plugins/remote_url.rb 21 def self.load_dependencies(uploader, *) 22 uploader.plugin :validation 23 end