Module: Shrine::Plugins::Signature

Defined in:
lib/shrine/plugins/signature.rb

Overview

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

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: SignatureCalculator

Constant Summary collapse

LOG_SUBSCRIBER =
-> (event) do
  Shrine.logger.info "Signature (#{event.duration}ms) – #{{
    io:        event[:io].class,
    algorithm: event[:algorithm],
    format:    event[:format],
    uploader:  event[:uploader],
  }.inspect}"
end
SUPPORTED_ALGORITHMS =
SignatureCalculator::SUPPORTED_ALGORITHMS
SUPPORTED_FORMATS =
SignatureCalculator::SUPPORTED_FORMATS

Class Method Summary collapse

Class Method Details

.configure(uploader, log_subscriber: LOG_SUBSCRIBER) ⇒ Object


16
17
18
19
# File 'lib/shrine/plugins/signature.rb', line 16

def self.configure(uploader, log_subscriber: LOG_SUBSCRIBER)
  # instrumentation plugin integration
  uploader.subscribe(:signature, &log_subscriber) if uploader.respond_to?(:subscribe)
end