Class: TranslationCms::SyncAssetDestroyer
- Inherits:
-
Object
- Object
- TranslationCms::SyncAssetDestroyer
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Conversion, ActiveModel::Validations
- Defined in:
- lib/translation_cms/sync_asset_destroyer.rb
Instance Attribute Summary collapse
-
#asset ⇒ Object
readonly
Returns the value of attribute asset.
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
Instance Method Summary collapse
-
#initialize(asset, current_user) ⇒ SyncAssetDestroyer
constructor
A new instance of SyncAssetDestroyer.
- #perform ⇒ Object
Constructor Details
#initialize(asset, current_user) ⇒ SyncAssetDestroyer
Returns a new instance of SyncAssetDestroyer.
14 15 16 17 |
# File 'lib/translation_cms/sync_asset_destroyer.rb', line 14 def initialize(asset, current_user) @asset = asset @current_user = current_user end |
Instance Attribute Details
#asset ⇒ Object (readonly)
Returns the value of attribute asset.
9 10 11 |
# File 'lib/translation_cms/sync_asset_destroyer.rb', line 9 def asset @asset end |
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
9 10 11 |
# File 'lib/translation_cms/sync_asset_destroyer.rb', line 9 def current_user @current_user end |
Instance Method Details
#perform ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/translation_cms/sync_asset_destroyer.rb', line 19 def perform return false unless valid? if asset.assetable? sync_delete_with_api else asset.destroy end end |