module Shrine::Plugins::RemoteUrl

Documentation can be found on shrinerb.com/docs/plugins/remote_url

Constants

DOWNLOADER
LOG_SUBSCRIBER

Public Class Methods

configure(uploader, log_subscriber: LOG_SUBSCRIBER, **opts) click to toggle source
# File lib/shrine/plugins/remote_url.rb, line 25
def self.configure(uploader, log_subscriber: LOG_SUBSCRIBER, **opts)
  uploader.opts[:remote_url] ||= { downloader: DOWNLOADER }
  uploader.opts[:remote_url].merge!(opts)

  unless uploader.opts[:remote_url].key?(:max_size)
    fail Error, "The :max_size option is required for remote_url plugin"
  end

  # instrumentation plugin integration
  uploader.subscribe(:remote_url, &log_subscriber) if uploader.respond_to?(:subscribe)
end
load_dependencies(uploader, *) click to toggle source
# File lib/shrine/plugins/remote_url.rb, line 21
def self.load_dependencies(uploader, *)
  uploader.plugin :validation
end