Module: Shrine::Plugins::DirectUpload

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

Overview

Documentation lives in [doc/plugins/direct_upload.md] on GitHub.

[doc/plugins/direct_upload.md]: github.com/shrinerb/shrine/blob/master/doc/plugins/direct_upload.md

Defined Under Namespace

Modules: ClassMethods Classes: App

Class Method Summary collapse

Class Method Details

.configure(uploader, opts = {}) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/shrine/plugins/direct_upload.rb', line 18

def self.configure(uploader, opts = {})
  uploader.opts[:direct_upload_allowed_storages] = opts.fetch(:allowed_storages, uploader.opts.fetch(:direct_upload_allowed_storages, [:cache]))
  uploader.opts[:direct_upload_presign_options] = opts.fetch(:presign_options, uploader.opts.fetch(:direct_upload_presign_options, {}))
  uploader.opts[:direct_upload_presign_location] = opts.fetch(:presign_location, uploader.opts[:direct_upload_presign_location])
  uploader.opts[:direct_upload_max_size] = opts.fetch(:max_size, uploader.opts[:direct_upload_max_size])

  uploader.assign_upload_endpoint(App) unless uploader.const_defined?(:UploadEndpoint)
end

.load_dependencies(uploader) ⇒ Object



14
15
16
# File 'lib/shrine/plugins/direct_upload.rb', line 14

def self.load_dependencies(uploader, *)
  uploader.plugin :rack_file
end