Sha256: 737de3971017486c97e6abe4e4e4014cda5122928f82935d916b0ca19eb2978d

Contents?: true

Size: 675 Bytes

Versions: 1

Compression:

Stored size: 675 Bytes

Contents

# frozen_string_literal: true

module ImageProcessing
  # Null processor for image_processing that keeps source files untouched
  # and copy them to the destination if provided.
  module Null
    extend Chainable

    def self.valid_image?(file) = true

    class Processor < ImageProcessing::Processor
      def self.call(source:, loader:, operations:, saver:, destination: nil)
        fail ArgumentError, "A string path is expected, got #{source.class}" unless source.is_a?(String)
        fail ArgumentError, "File not found: #{source}" unless File.file?(source)

        if destination
          FileUtils.cp(source, destination)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wasmify-rails-0.1.0 lib/image_processing/null.rb