Sha256: fbd899d77ee58774148f4fb09f3fb46acb2ef0fa1bd6f13299601840edd6055e
Contents?: true
Size: 668 Bytes
Versions: 1
Compression:
Stored size: 668 Bytes
Contents
module ImageProcessing class Processor def initialize(pipeline) @pipeline = pipeline end def apply(image, operations) operations.inject(image) do |result, (name, args)| if args == true || args.nil? apply_operation(name, result) else apply_operation(name, result, *args) end end end def apply_operation(name, image, *args) if respond_to?(name) public_send(name, image, *args) else image.send(name, *args) end end def custom(image, block) (block && block.call(image)) || image end private attr_reader :pipeline end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
image_processing-1.1.0 | lib/image_processing/processor.rb |