class ActiveStorage::Transformers::ImageProcessingTransformer

Private Instance Methods

operations() click to toggle source
# File lib/active_storage/transformers/image_processing_transformer.rb, line 29
        def operations
          transformations.each_with_object([]) do |(name, argument), list|
            if name.to_s == "combine_options"
              raise ArgumentError, <<~ERROR.squish
                Active Storage's ImageProcessing transformer doesn't support :combine_options,
                as it always generates a single command.
              ERROR
            end

            if argument.present?
              list << [ name, argument ]
            end
          end
        end
process(file, format:) click to toggle source
# File lib/active_storage/transformers/image_processing_transformer.rb, line 16
def process(file, format:)
  processor.
    source(file).
    loader(page: 0).
    convert(format).
    apply(operations).
    call
end
processor() click to toggle source
# File lib/active_storage/transformers/image_processing_transformer.rb, line 25
def processor
  ImageProcessing.const_get(ActiveStorage.variant_processor.to_s.camelize)
end