module Shrine::Plugins::Derivatives

  1. lib/shrine/plugins/derivatives.rb

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

Methods

Public Class

  1. configure
  2. load_dependencies

Constants

LOG_SUBSCRIBER = -> (event) do Shrine.logger.info "Derivatives (#{event.duration}ms) – #{{ processor: event[:processor], processor_options: event[:processor_options], uploader: event[:uploader], }.inspect}" end  

Public Class methods

configure(uploader, log_subscriber: LOG_SUBSCRIBER, versions_compatibility: false, **opts)
[show source]
   # File lib/shrine/plugins/derivatives.rb
19 def self.configure(uploader, log_subscriber: LOG_SUBSCRIBER, versions_compatibility: false, **opts)
20   uploader.opts[:derivatives] ||= { processors: {}, processor_settings: {}, storage: proc { store_key }, mutex: true }
21   uploader.opts[:derivatives].merge!(opts)
22 
23   # instrumentation plugin integration
24   uploader.subscribe(:derivatives, &log_subscriber) if uploader.respond_to?(:subscribe)
25 
26   uploader::Attacher.include(VersionsCompatibility) if versions_compatibility
27 end
load_dependencies(uploader, **)
[show source]
   # File lib/shrine/plugins/derivatives.rb
15 def self.load_dependencies(uploader, **)
16   uploader.plugin :default_url
17 end