Module in which all Shrine
plugins should be stored. Also contains logic for registering and loading plugins.
Classes and Modules
- Shrine::Plugins::Activerecord
- Shrine::Plugins::AddMetadata
- Shrine::Plugins::Backgrounding
- Shrine::Plugins::CachedAttachmentData
- Shrine::Plugins::Column
- Shrine::Plugins::DataUri
- Shrine::Plugins::DefaultStorage
- Shrine::Plugins::DefaultUrl
- Shrine::Plugins::DeleteRaw
- Shrine::Plugins::DerivationEndpoint
- Shrine::Plugins::Derivatives
- Shrine::Plugins::DetermineMimeType
- Shrine::Plugins::DownloadEndpoint
- Shrine::Plugins::DynamicStorage
- Shrine::Plugins::Entity
- Shrine::Plugins::FormAssign
- Shrine::Plugins::Included
- Shrine::Plugins::InferExtension
- Shrine::Plugins::Instrumentation
- Shrine::Plugins::KeepFiles
- Shrine::Plugins::MetadataAttributes
- Shrine::Plugins::Mirroring
- Shrine::Plugins::Model
- Shrine::Plugins::ModuleInclude
- Shrine::Plugins::MultiCache
- Shrine::Plugins::Persistence
- Shrine::Plugins::PresignEndpoint
- Shrine::Plugins::PrettyLocation
- Shrine::Plugins::Processing
- Shrine::Plugins::RackFile
- Shrine::Plugins::RackResponse
- Shrine::Plugins::Recache
- Shrine::Plugins::RefreshMetadata
- Shrine::Plugins::RemoteUrl
- Shrine::Plugins::RemoveAttachment
- Shrine::Plugins::RemoveInvalid
- Shrine::Plugins::RestoreCachedData
- Shrine::Plugins::Sequel
- Shrine::Plugins::Signature
- Shrine::Plugins::StoreDimensions
- Shrine::Plugins::Tempfile
- Shrine::Plugins::TypePredicates
- Shrine::Plugins::UploadEndpoint
- Shrine::Plugins::UploadOptions
- Shrine::Plugins::UrlOptions
- Shrine::Plugins::UrlsafeSerialization
- Shrine::Plugins::Validation
- Shrine::Plugins::ValidationHelpers
- Shrine::Plugins::Versions
- Shrine::Plugins::AtomicHelpers
Public Class methods
configure(plugin, uploader, *args, **kwargs, &block)
Delegate call to the plugin in a way that works across Ruby versions.
[show source]
# File lib/shrine/plugins.rb 33 def self.configure(plugin, uploader, *args, **kwargs, &block) 34 return unless plugin.respond_to?(:configure) 35 36 if kwargs.any? 37 plugin.configure(uploader, *args, **kwargs, &block) 38 else 39 plugin.configure(uploader, *args, &block) 40 end 41 end
load_dependencies(plugin, uploader, *args, **kwargs, &block)
Delegate call to the plugin in a way that works across Ruby versions.
[show source]
# File lib/shrine/plugins.rb 22 def self.load_dependencies(plugin, uploader, *args, **kwargs, &block) 23 return unless plugin.respond_to?(:load_dependencies) 24 25 if kwargs.any? 26 plugin.load_dependencies(uploader, *args, **kwargs, &block) 27 else 28 plugin.load_dependencies(uploader, *args, &block) 29 end 30 end
load_plugin(name)
If the registered plugin already exists, use it. Otherwise, require it and return it. This raises a LoadError if such a plugin doesn’t exist, or a Shrine::Error
if it exists but it does not register itself correctly.
[show source]
# File lib/shrine/plugins.rb 13 def self.load_plugin(name) 14 unless plugin = @plugins[name] 15 require "shrine/plugins/#{name}" 16 raise Error, "plugin #{name} did not register itself correctly in Shrine::Plugins" unless plugin = @plugins[name] 17 end 18 plugin 19 end
register_plugin(name, mod)
Register the given plugin with Shrine
, so that it can be loaded using Shrine.plugin
with a symbol. Should be used by plugin files. Example:
Shrine::Plugins.register_plugin(:plugin_name, PluginModule)
[show source]
# File lib/shrine/plugins.rb 47 def self.register_plugin(name, mod) 48 @plugins[name] = mod 49 end