module Shrine::ClassMethods
Defined in:
shrine.crInstance Method Summary
- #cache(io, **options)
-
#find_storage(name : String)
Retrieves the storage under the given identifier (Symbol), raising Shrine::Error if the storage is missing.
- #raise_if_missing_settings!
- #store(io, **options)
-
#upload(io, storage, **options)
Uploads the file to the specified storage.
- #uploaded_file(hash : Hash(String, String | UploadedFile::MetadataType))
- #uploaded_file(json : String)
- #uploaded_file(object : UploadedFile)
-
#warn(message)
Prints a warning to the logger.
-
#with_file(io : IO, &)
Temporarily converts an IO-like object into a file.
- #with_file(uploaded_file : UploadedFile, &)
Instance Method Detail
def find_storage(name : String)
#
Retrieves the storage under the given identifier (Symbol), raising Shrine::Error if the storage is missing.
def upload(io, storage, **options)
#
Uploads the file to the specified storage. It delegates to Shrine#upload
.
Shrine.upload(io, :store) # => #<Shrine::UploadedFile>
def with_file(io : IO, &)
#
Temporarily converts an IO-like object into a file. If the input IO object is already a file, it simply yields it to the block, otherwise it copies IO content into a Tempfile object which is then yielded and afterwards deleted.
Shrine.with_file(io) { |file| file.path }