class ImageOptim::CachePath

ImageOptiom::Path with a non self destructing replace method

Public Instance Methods

replace(dst) click to toggle source

Atomic replace dst with self

# File lib/image_optim/cache_path.rb, line 7
def replace(dst)
  dst = self.class.new(dst)
  dst.temp_path(dst.dirname) do |temp|
    copy(temp)
    dst.copy_metadata(temp)
    temp.rename(dst.to_s)
  end
end