module Shrine::Plugins::DetermineMimeType

  1. lib/shrine/plugins/determine_mime_type.rb

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

Methods

Public Class

  1. configure

Constants

LOG_SUBSCRIBER = -> (event) do Shrine.logger.info "MIME Type (#{event.duration}ms) – #{{ io: event[:io].class, uploader: event[:uploader], }.inspect}" end  

Public Class methods

configure (uploader, log_subscriber: LOG_SUBSCRIBER, **opts)
[show source]
   # File lib/shrine/plugins/determine_mime_type.rb
14 def self.configure(uploader, log_subscriber: LOG_SUBSCRIBER, **opts)
15   uploader.opts[:determine_mime_type] ||= { analyzer: :file, analyzer_options: {} }
16   uploader.opts[:determine_mime_type].merge!(opts)
17 
18   # instrumentation plugin integration
19   uploader.subscribe(:mime_type, &log_subscriber) if uploader.respond_to?(:subscribe)
20 end