module
Latch::Processor
Overview
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.
Direct including types
Defined in:
latch/processor.crMacro Summary
-
original(**options)
Defines processing options for the original file.
-
process(&block)
Generates the boilerplate
self.processon the concrete type. -
variant(name, **options)
Defines a named variant.
Macro Detail
Defines processing options for the original file. The original is processed after all variants, so they use the maximum available quality.
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.
Defines a named variant. Options are validated at compile time against the
@[Latch::VariantOptions(...)] annotation on the processor.