module Latch

Included Modules

Defined in:

latch/base.cr
latch/config.cr
latch/uploaded_file.cr
latch/utilities.cr
latch/version.cr

Constant Summary

HABITAT_SETTINGS = [{decl: storages : Hash(String, Storage) = {} of String => Storage, example: nil, validation: nil}, {decl: path_prefix : String = ":model/:id/:attachment", example: nil, validation: nil}] of Nil
VERSION = {{ (`shards version \"/home/runner/work/latch/latch/src/latch\"`).chomp.stringify }}

Class Method Summary

Instance Method Summary

Class Method Detail

def self.configure(&) #

[View source]
def self.find_storage(name : String) : Storage #

Retrieves a storage by name, raising if not found.

Latch.find_storage("store")   # => Storage::FileSystem
Latch.find_storage("missing") # raises Latch::Error

[View source]
def self.settings #

[View source]
def self.with_file(io : IO, &) #

Utility to work with a file IO. If the IO is already a File, yields it directly, Otherwise copies to a tempfile, yields it, then cleans up.

Latch.with_file(io) do |file|
  # file is guaranteed to be a File with a path
end

[View source]
def self.with_file(uploaded_file : StoredFile, &) #

[View source]

Instance Method Detail

def settings #

[View source]