Sha256: 6060f1cd573457b6bd02adfdbe631aa84f03d5055adc9dd75e0aaaa0e9f684b5

Contents?: true

Size: 577 Bytes

Versions: 1

Compression:

Stored size: 577 Bytes

Contents

# frozen_string_literal: true

module Paperweight
  # Queues post processing.
  class PostProcessJob < ActiveJob::Base
    queue_as :default

    discard_on ActiveJob::DeserializationError

    def perform(model, name)
      name = AttachmentName.new(name)
      image_url = model.public_send(name.processing)

      return unless image_url

      model.update!(
        name.name => Download.download(image_url),
        name.processing => nil
      )

      return unless model.respond_to?(name.after_download)

      model.public_send(name.after_download)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paperweight-1.1.0 lib/paperweight/post_process_job.rb