module

Latch

Inherits Habitat::SettingsHelpers / Habitat::TempConfig

Constants

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 \"/tmp/tmp.BbOcNK/src/src/latch\"`).chomp.stringify }}

Class methods

configure
Source
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
Source
settings
Source
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
Source
with_file(uploaded_file : StoredFile, &)
Source

Instance methods

settings
Source

Nested types