module Shrine::InstanceMethods
Direct including types
Defined in:
shrine.crConstructors
Instance Method Summary
-
#generate_location(io : IO | UploadedFile, metadata, **options)
Generates a unique location for the uploaded file, preserving the file extension.
-
#generate_uid(io)
Generates a unique identifier that can be used for a location.
-
#storage
Returns the storage object referenced by the identifier.
- #storage_key : String
-
#upload(io : IO | UploadedFile, **options)
The main method for uploading files.
-
#warn(message)
Prints a warning to the logger.
Constructor Detail
Instance Method Detail
Generates a unique location for the uploaded file, preserving the file extension. Can be overriden in uploaders for generating custom location.
The main method for uploading files. Takes an IO-like object and an
optional context hash (used internally by Shrine::Attacher). It calls
user-defined #process, and afterwards it calls #store. The io
is
closed after upload.
uploader.upload(io) uploader.upload(io, metadata: { "foo" => "bar" }) # add metadata uploader.upload(io, location: "path/to/file") # specify location uploader.upload(io, upload_options: { acl: "public-read" }) # add upload options