Class: ActiveStorage::CloudTransformations::Preview

Inherits:
Preview
  • Object
show all
Defined in:
lib/active_storage/cloud_transformations/preview.rb

Instance Method Summary collapse

Instance Method Details

#processObject



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/active_storage/cloud_transformations/preview.rb', line 4

def process
  # if image.attached?
  #   if image.variant(variation).processed?
  #     variant
  #   else
  #     create_blob_preview_image_variant
  #   end
  # else
  if !blob.preview_image.attached?
    create_blob_preview_image_and_blob_preview_image_variant
  end
  self
end

#processed?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/active_storage/cloud_transformations/preview.rb', line 18

def processed?
  image.variant(variation)&.processed?
end