MartenStorages::Configuration
Module-level configuration. Currently exposes a registry of named variant specs (so apps can declare a "thumbnail" or "large" set of resize options once and reuse them across attach call sites) plus the default variant output format.
MartenStorages.configure do |c| c.default_variant_format = "jpg" c.register_variant("thumbnail", max_dimension: 600) c.register_variant("large", max_dimension: 1500) end
Variant specs are opt-in. The Service.attach call site can pass
variants: {"large" => VariantPipeline::Spec.new(max_dimension: 1500)}
directly without ever touching the registry — the registry is just
sugar for naming a spec once and reusing it.
Instance methods
Output format for resized variants. "jpg" (default) routes
through vips' write_to_file with a .jpg extension; other
values must be extensions vips can write (e.g. "png", "webp").
Per-spec format: overrides this on a per-variant basis (see
VariantPipeline::Spec#format).
Output format for resized variants. "jpg" (default) routes
through vips' write_to_file with a .jpg extension; other
values must be extensions vips can write (e.g. "png", "webp").
Per-spec format: overrides this on a per-variant basis (see
VariantPipeline::Spec#format).
Register a named variant spec.
Boot-time only (review §9): Hash#[]= is not safe under
concurrent fiber mutation, so call from a single boot fiber inside
MartenStorages.configure { ... } and never mutate the registry
while request fibers are reading it. Re-registering the same
kind raises (review §13) so a typo or accidental double
registration is surfaced loudly instead of silently last-write-wins.
Map of variant-kind name → spec. See VariantPipeline::Spec for
the spec shape. Populated via register_variant.