Class: Refile::Backgrounder::StoreWorker

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/refile/backgrounder/store_worker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attachment_nameObject (readonly)

Returns the value of attribute attachment_name.



4
5
6
# File 'lib/refile/backgrounder/store_worker.rb', line 4

def attachment_name
  @attachment_name
end

#recordObject (readonly)

Returns the value of attribute record.



4
5
6
# File 'lib/refile/backgrounder/store_worker.rb', line 4

def record
  @record
end

Instance Method Details

#perform(record, attachment_name) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/refile/backgrounder/store_worker.rb', line 7

def perform(record, attachment_name)
  @record = record
  @attachment_name = attachment_name
  return unless attachment_cached?

  file = upload attacher.get
  cleanup_cache!
  update_record_attachment(file) if file
  yield if block_given?
end