ImageProcessing::Chainable(P, Acc)
Implements a chainable interface for building processing options. P is
the processor class, Acc its accumulator type. It is both included into
Builder and extended into the ImageProcessing::Vips / MiniMagick modules,
mirroring Ruby's extend Chainable.
Instance methods
Add multiple operations as a hash or an array.
.apply({resize_to_limit: [400, 400], strip: true})
or
.apply([{"resize_to_limit", [400, 400]}, {"strip", true}])
Creates a new builder object, merging current options with new options.
Call the defined processing and get the result. Allows specifying the source file and destination.
Calls the given block with the accumulator object directly. Useful for when you want to access the accumulator object directly. Without a block the operation is a no-op returning the accumulator.
Register instrumentation block that will be called around the pipeline. The block receives the pipeline options and a callable that runs the pipeline; its return value is ignored, like in the Ruby version.
Add an operation defined by the processor.
Runtime variant used by #apply and the generated bang methods, with already-normalized arguments.
Creates a stack in the accumulator (MiniMagick parentheses). Generic on
Chainable so that the module-function form (MiniMagick.stack { })
works without method_missing, which Crystal cannot do for modules.
Macros
Assume that any unknown method names an operation supported by the processor. Add a bang ("!") if you want processing to be performed.
Crystal's method_missing hook cannot generate defs that match calls with named arguments unless the named arguments are spelled out, so they are generated explicitly from the call site.