module Shrine::Plugins

  1. lib/shrine/plugins.rb
  2. lib/shrine/plugins/_persistence.rb
  3. lib/shrine/plugins/_urlsafe_serialization.rb
  4. lib/shrine/plugins/activerecord.rb
  5. lib/shrine/plugins/add_metadata.rb
  6. lib/shrine/plugins/atomic_helpers.rb
  7. lib/shrine/plugins/backgrounding.rb
  8. lib/shrine/plugins/cached_attachment_data.rb
  9. lib/shrine/plugins/column.rb
  10. lib/shrine/plugins/data_uri.rb
  11. lib/shrine/plugins/default_storage.rb
  12. lib/shrine/plugins/default_url.rb
  13. lib/shrine/plugins/default_url_options.rb
  14. lib/shrine/plugins/delete_raw.rb
  15. lib/shrine/plugins/derivation_endpoint.rb
  16. lib/shrine/plugins/derivatives.rb
  17. lib/shrine/plugins/determine_mime_type.rb
  18. lib/shrine/plugins/download_endpoint.rb
  19. lib/shrine/plugins/dynamic_storage.rb
  20. lib/shrine/plugins/entity.rb
  21. lib/shrine/plugins/form_assign.rb
  22. lib/shrine/plugins/included.rb
  23. lib/shrine/plugins/infer_extension.rb
  24. lib/shrine/plugins/instrumentation.rb
  25. lib/shrine/plugins/keep_files.rb
  26. lib/shrine/plugins/metadata_attributes.rb
  27. lib/shrine/plugins/mirroring.rb
  28. lib/shrine/plugins/model.rb
  29. lib/shrine/plugins/module_include.rb
  30. lib/shrine/plugins/multi_cache.rb
  31. lib/shrine/plugins/presign_endpoint.rb
  32. lib/shrine/plugins/pretty_location.rb
  33. lib/shrine/plugins/processing.rb
  34. lib/shrine/plugins/rack_file.rb
  35. lib/shrine/plugins/rack_response.rb
  36. lib/shrine/plugins/recache.rb
  37. lib/shrine/plugins/refresh_metadata.rb
  38. lib/shrine/plugins/remote_url.rb
  39. lib/shrine/plugins/remove_attachment.rb
  40. lib/shrine/plugins/remove_invalid.rb
  41. lib/shrine/plugins/restore_cached_data.rb
  42. lib/shrine/plugins/sequel.rb
  43. lib/shrine/plugins/signature.rb
  44. lib/shrine/plugins/store_dimensions.rb
  45. lib/shrine/plugins/tempfile.rb
  46. lib/shrine/plugins/type_predicates.rb
  47. lib/shrine/plugins/upload_endpoint.rb
  48. lib/shrine/plugins/upload_options.rb
  49. lib/shrine/plugins/url_options.rb
  50. lib/shrine/plugins/validation.rb
  51. lib/shrine/plugins/validation_helpers.rb
  52. lib/shrine/plugins/versions.rb
  53. show all

Module in which all Shrine plugins should be stored. Also contains logic for registering and loading plugins.

Classes and Modules

  1. Shrine::Plugins::Activerecord
  2. Shrine::Plugins::AddMetadata
  3. Shrine::Plugins::Backgrounding
  4. Shrine::Plugins::CachedAttachmentData
  5. Shrine::Plugins::Column
  6. Shrine::Plugins::DataUri
  7. Shrine::Plugins::DefaultStorage
  8. Shrine::Plugins::DefaultUrl
  9. Shrine::Plugins::DeleteRaw
  10. Shrine::Plugins::DerivationEndpoint
  11. Shrine::Plugins::Derivatives
  12. Shrine::Plugins::DetermineMimeType
  13. Shrine::Plugins::DownloadEndpoint
  14. Shrine::Plugins::DynamicStorage
  15. Shrine::Plugins::Entity
  16. Shrine::Plugins::FormAssign
  17. Shrine::Plugins::Included
  18. Shrine::Plugins::InferExtension
  19. Shrine::Plugins::Instrumentation
  20. Shrine::Plugins::KeepFiles
  21. Shrine::Plugins::MetadataAttributes
  22. Shrine::Plugins::Mirroring
  23. Shrine::Plugins::Model
  24. Shrine::Plugins::ModuleInclude
  25. Shrine::Plugins::MultiCache
  26. Shrine::Plugins::Persistence
  27. Shrine::Plugins::PresignEndpoint
  28. Shrine::Plugins::PrettyLocation
  29. Shrine::Plugins::Processing
  30. Shrine::Plugins::RackFile
  31. Shrine::Plugins::RackResponse
  32. Shrine::Plugins::Recache
  33. Shrine::Plugins::RefreshMetadata
  34. Shrine::Plugins::RemoteUrl
  35. Shrine::Plugins::RemoveAttachment
  36. Shrine::Plugins::RemoveInvalid
  37. Shrine::Plugins::RestoreCachedData
  38. Shrine::Plugins::Sequel
  39. Shrine::Plugins::Signature
  40. Shrine::Plugins::StoreDimensions
  41. Shrine::Plugins::Tempfile
  42. Shrine::Plugins::TypePredicates
  43. Shrine::Plugins::UploadEndpoint
  44. Shrine::Plugins::UploadOptions
  45. Shrine::Plugins::UrlOptions
  46. Shrine::Plugins::UrlsafeSerialization
  47. Shrine::Plugins::Validation
  48. Shrine::Plugins::ValidationHelpers
  49. Shrine::Plugins::Versions
  50. 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