Sha256: db4e05443769984b815d0c89d74fd9f4c51d4f1fd0832d3deb9080a3c5febf00

Contents?: true

Size: 407 Bytes

Versions: 2

Compression:

Stored size: 407 Bytes

Contents

# frozen_string_literal: true

require 'image_optim/path'

class ImageOptim
  # ImageOptiom::Path with a non self destructing #replace method
  class CachePath < Path
    # Atomic replace dst with self
    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
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
image_optim-0.26.5 lib/image_optim/cache_path.rb
image_optim-0.26.4 lib/image_optim/cache_path.rb