Sha256: 42f294a7ecd8885fcf7db20c4799b94e5d075bac2b084320a15f3cea41ab8113

Contents?: true

Size: 376 Bytes

Versions: 14

Compression:

Stored size: 376 Bytes

Contents

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

14 entries across 14 versions & 2 rubygems

Version Path
image_optim-0.26.3 lib/image_optim/cache_path.rb
image_optim-0.26.2 lib/image_optim/cache_path.rb
discourse_image_optim-0.26.2 lib/image_optim/cache_path.rb
discourse_image_optim-0.26.1 lib/image_optim/cache_path.rb
image_optim-0.26.1 lib/image_optim/cache_path.rb
image_optim-0.26.0 lib/image_optim/cache_path.rb
image_optim-0.25.0 lib/image_optim/cache_path.rb
discourse_image_optim-0.24.5 lib/image_optim/cache_path.rb
image_optim-0.24.3 lib/image_optim/cache_path.rb
discourse_image_optim-0.24.4 lib/image_optim/cache_path.rb
image_optim-0.24.2 lib/image_optim/cache_path.rb
image_optim-0.24.1 lib/image_optim/cache_path.rb
image_optim-0.24.0 lib/image_optim/cache_path.rb
image_optim-0.23.0 lib/image_optim/cache_path.rb