module

Latch::Processor

Base module for processors that transform uploaded files into variants. Provides the variant and original macros with compile-time validation against a @[Latch::VariantOptions(...)] annotation declared by the concrete processor module.

Non-nilable annotation types are required in every variant call, nilable types are optional. Unknown keys cause a compile-time error.

See Latch::Processor::Magick for an ImageMagick-based implementation.

Macros

original

Defines processing options for the original file. The original is processed after all variants, so they use the maximum available quality.

Source
process

Generates the boilerplate self.process on the concrete type. The block body is expanded inside the variant loop with stored_file, storage, name, tempfile, variant_name, and variant_options in scope.

Variants are processed first, then the original (if defined), so that variants always use the maximum available quality.

Source
variant(name, **options)

Defines a named variant. Options are validated at compile time against the @[Latch::VariantOptions(...)] annotation on the processor.

Source

Nested types