Module: Shrine::Plugins::MigrationHelpers::AttacherMethods
- Defined in:
- lib/shrine/plugins/migration_helpers.rb
Instance Method Summary collapse
-
#cached? ⇒ Boolean
Returns true if the attachment is present and is uploaded by the temporary storage.
-
#stored? ⇒ Boolean
Returns true if the attachment is present and is uploaded by the permanent storage.
-
#update_stored(&block) ⇒ Object
Updates the attachment with the result of the block.
Instance Method Details
#cached? ⇒ Boolean
Returns true if the attachment is present and is uploaded by the temporary storage.
56 57 58 |
# File 'lib/shrine/plugins/migration_helpers.rb', line 56 def cached? get && cache.uploaded?(get) end |
#stored? ⇒ Boolean
Returns true if the attachment is present and is uploaded by the permanent storage.
62 63 64 |
# File 'lib/shrine/plugins/migration_helpers.rb', line 62 def stored? get && store.uploaded?(get) end |
#update_stored(&block) ⇒ Object
Updates the attachment with the result of the block. It will get called only if the attachment exists and is stored.
48 49 50 51 52 |
# File 'lib/shrine/plugins/migration_helpers.rb', line 48 def update_stored(&block) return if get.nil? || cache.uploaded?(get) = block.call(get) swap() end |