class ImageProcessing::Builder

Attributes

options[R]

Public Class Methods

new(options) click to toggle source
# File lib/image_processing/builder.rb, line 7
def initialize(options)
  @options = options
end

Public Instance Methods

call!(**call_options) click to toggle source

Calls the pipeline to perform the processing from built options.

# File lib/image_processing/builder.rb, line 12
def call!(**call_options)
  instrument do
    Pipeline.new(pipeline_options).call(**call_options)
  end
end

Private Instance Methods

instrument() { || ... } click to toggle source
# File lib/image_processing/builder.rb, line 20
def instrument
  return yield unless options[:instrumenter]

  result = nil
  options[:instrumenter].call(**pipeline_options) { result = yield }
  result
end
pipeline_options() click to toggle source
# File lib/image_processing/builder.rb, line 28
def pipeline_options
  options.reject { |key, _| key == :instrumenter }
end