Class: CarrierWave::Workers::StoreAsset
- Inherits:
-
Struct
- Object
- Struct
- CarrierWave::Workers::StoreAsset
- Includes:
- Sidekiq::Worker
- Defined in:
- lib/backgrounder/workers/store_asset.rb
Instance Attribute Summary collapse
-
#cache_path ⇒ Object
readonly
Returns the value of attribute cache_path.
-
#column ⇒ Object
Returns the value of attribute column.
-
#id ⇒ Object
Returns the value of attribute id.
-
#klass ⇒ Object
Returns the value of attribute klass.
-
#tmp_directory ⇒ Object
readonly
Returns the value of attribute tmp_directory.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#cache_path ⇒ Object (readonly)
Returns the value of attribute cache_path.
7 8 9 |
# File 'lib/backgrounder/workers/store_asset.rb', line 7 def cache_path @cache_path end |
#column ⇒ Object
Returns the value of attribute column
5 6 7 |
# File 'lib/backgrounder/workers/store_asset.rb', line 5 def column @column end |
#id ⇒ Object
Returns the value of attribute id
5 6 7 |
# File 'lib/backgrounder/workers/store_asset.rb', line 5 def id @id end |
#klass ⇒ Object
Returns the value of attribute klass
5 6 7 |
# File 'lib/backgrounder/workers/store_asset.rb', line 5 def klass @klass end |
#tmp_directory ⇒ Object (readonly)
Returns the value of attribute tmp_directory.
7 8 9 |
# File 'lib/backgrounder/workers/store_asset.rb', line 7 def tmp_directory @tmp_directory end |
Class Method Details
.perform(*args) ⇒ Object
9 10 11 |
# File 'lib/backgrounder/workers/store_asset.rb', line 9 def self.perform(*args) new(*args).perform end |
Instance Method Details
#perform(*args) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/backgrounder/workers/store_asset.rb', line 13 def perform(*args) set_args(*args) if args.present? record = constantized_resource.find id if record.send(:"#{column}_tmp") store_directories(record) record.send :"process_#{column}_upload=", true record.send :"#{column}_tmp=", nil File.open(cache_path) { |f| record.send :"#{column}=", f } if record.save! FileUtils.rm_r(tmp_directory, :force => true) end end end |