Class: ImageProcessing::Null::Processor

Inherits:
Processor
  • Object
show all
Defined in:
lib/image_processing/null.rb

Class Method Summary collapse

Class Method Details

.call(source:, loader:, operations:, saver:, destination: nil) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/image_processing/null.rb', line 12

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
    File.delete(destination) if File.identical?(source, destination)
    FileUtils.cp(source, destination)
  end
end