module Shrine::Plugins

  1. lib/shrine.rb
  2. lib/shrine/plugins/activerecord.rb
  3. lib/shrine/plugins/add_metadata.rb
  4. lib/shrine/plugins/background_helpers.rb
  5. lib/shrine/plugins/backgrounding.rb
  6. lib/shrine/plugins/backup.rb
  7. lib/shrine/plugins/cached_attachment_data.rb
  8. lib/shrine/plugins/copy.rb
  9. lib/shrine/plugins/data_uri.rb
  10. lib/shrine/plugins/default_storage.rb
  11. lib/shrine/plugins/default_url.rb
  12. lib/shrine/plugins/default_url_options.rb
  13. lib/shrine/plugins/delete_promoted.rb
  14. lib/shrine/plugins/delete_raw.rb
  15. lib/shrine/plugins/determine_mime_type.rb
  16. lib/shrine/plugins/direct_upload.rb
  17. lib/shrine/plugins/download_endpoint.rb
  18. lib/shrine/plugins/dynamic_storage.rb
  19. lib/shrine/plugins/hooks.rb
  20. lib/shrine/plugins/included.rb
  21. lib/shrine/plugins/keep_files.rb
  22. lib/shrine/plugins/logging.rb
  23. lib/shrine/plugins/metadata_attributes.rb
  24. lib/shrine/plugins/migration_helpers.rb
  25. lib/shrine/plugins/module_include.rb
  26. lib/shrine/plugins/moving.rb
  27. lib/shrine/plugins/multi_delete.rb
  28. lib/shrine/plugins/parallelize.rb
  29. lib/shrine/plugins/parsed_json.rb
  30. lib/shrine/plugins/presign_endpoint.rb
  31. lib/shrine/plugins/pretty_location.rb
  32. lib/shrine/plugins/processing.rb
  33. lib/shrine/plugins/rack_file.rb
  34. lib/shrine/plugins/rack_response.rb
  35. lib/shrine/plugins/recache.rb
  36. lib/shrine/plugins/refresh_metadata.rb
  37. lib/shrine/plugins/remote_url.rb
  38. lib/shrine/plugins/remove_attachment.rb
  39. lib/shrine/plugins/remove_invalid.rb
  40. lib/shrine/plugins/restore_cached_data.rb
  41. lib/shrine/plugins/sequel.rb
  42. lib/shrine/plugins/signature.rb
  43. lib/shrine/plugins/store_dimensions.rb
  44. lib/shrine/plugins/upload_endpoint.rb
  45. lib/shrine/plugins/upload_options.rb
  46. lib/shrine/plugins/validation_helpers.rb
  47. lib/shrine/plugins/versions.rb
  48. show all

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

Methods

Public Class

  1. load_plugin
  2. register_plugin

Public Class methods

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.rb, line 72
def self.load_plugin(name)
  unless plugin = @plugins[name]
    require "shrine/plugins/#{name}"
    raise Error, "plugin #{name} did not register itself correctly in Shrine::Plugins" unless plugin = @plugins[name]
  end
  plugin
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.rb, line 84
def self.register_plugin(name, mod)
  @plugins[name] = mod
end