module Shrine::Plugins::Backgrounding::AttacherClassMethods

  1. lib/shrine/plugins/backgrounding.rb

Methods

Public Instance

  1. destroy_block
  2. promote_block

Public Instance methods

destroy_block(&block)

Registers a global deletion block.

Shrine::Attacher.destroy_block do |attacher|
  Attachment::DestroyJob.perform_async(attacher.data)
end
[show source]
   # File lib/shrine/plugins/backgrounding.rb
31 def destroy_block(&block)
32   shrine_class.opts[:backgrounding][:destroy_block] = block if block
33   shrine_class.opts[:backgrounding][:destroy_block]
34 end
promote_block(&block)

Registers a global promotion block.

Shrine::Attacher.promote_block do |attacher|
  Attachment::PromoteJob.perform_async(
    attacher.record,
    attacher.name,
    attacher.file_data,
  )
end
[show source]
   # File lib/shrine/plugins/backgrounding.rb
21 def promote_block(&block)
22   shrine_class.opts[:backgrounding][:promote_block] = block if block
23   shrine_class.opts[:backgrounding][:promote_block]
24 end