Module: ImgproxyRails::Helpers

Defined in:
lib/imgproxy-rails/helpers.rb

Class Method Summary collapse

Class Method Details

.applicable_variation?(model) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
# File 'lib/imgproxy-rails/helpers.rb', line 5

def self.applicable_variation?(model)
  return false if !model.respond_to?(:variation)

  content_type = model.try(:blob)&.content_type
  content_type&.start_with?("image/") ||
    content_type&.start_with?("video/") ||
    content_type == "application/pdf"
end