class Shrine::Derivation::Upload

Public Instance Methods

call(derivative = nil, **options) click to toggle source

Uploads the derivation result to the dedicated location on the storage. If a file object is given, uploads that to the storage, otherwise calls the derivation block and uploads the result.

# File lib/shrine/plugins/derivation_endpoint.rb, line 649
def call(derivative = nil, **options)
  if derivative
    upload(derivative, **options)
  else
    upload(derivation.generate, delete: true, **options)
  end
end

Private Instance Methods

upload(io, **options) click to toggle source
# File lib/shrine/plugins/derivation_endpoint.rb, line 659
def upload(io, **options)
  shrine_class.upload io, upload_storage,
    location:       upload_location,
    upload_options: upload_options,
    action:         :derivation,
    **options
end