Class: Alchemy::PictureThumb::Signature

Inherits:
Object
  • Object
show all
Defined in:
app/models/alchemy/picture_thumb/signature.rb

Class Method Summary collapse

Class Method Details

.call(variant) ⇒ String

Returns a unique image process signature

Parameters:

Returns:

  • (String)


11
12
13
14
15
16
17
18
19
20
# File 'app/models/alchemy/picture_thumb/signature.rb', line 11

def self.call(variant)
  steps_without_fetch = variant.image.steps.reject do |step|
    step.is_a?(::Dragonfly::Job::Fetch)
  end

  steps_with_id = [[variant.picture.id]] + steps_without_fetch
  job_string = steps_with_id.map(&:to_a).to_dragonfly_unique_s

  Digest::SHA1.hexdigest(job_string)
end