Sha256: de1709ae33c0ebbac2da6b82c182d52cebbcf4b3001eec96a0a45d684c7f5674

Contents?: true

Size: 644 Bytes

Versions: 7

Compression:

Stored size: 644 Bytes

Contents

module ImageProcessing
  class Builder
    include Chainable

    attr_reader :options

    def initialize(options)
      @options = options
    end

    # Calls the pipeline to perform the processing from built options.
    def call!(**call_options)
      instrument do
        Pipeline.new(pipeline_options).call(**call_options)
      end
    end

    private

    def instrument
      return yield unless options[:instrumenter]

      result = nil
      options[:instrumenter].call(**pipeline_options) { result = yield }
      result
    end

    def pipeline_options
      options.reject { |key, _| key == :instrumenter }
    end
  end
end

Version data entries

7 entries across 6 versions & 3 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/image_processing-1.13.0/lib/image_processing/builder.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/image_processing-1.13.0/lib/image_processing/builder.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/image_processing-1.12.2/lib/image_processing/builder.rb
image_processing-1.13.0 lib/image_processing/builder.rb
image_processing-1.12.2 lib/image_processing/builder.rb
image_processing-1.12.1 lib/image_processing/builder.rb
image_processing-1.12.0 lib/image_processing/builder.rb