Sha256: d38a124ca1723de41d565b95395104eebdf2ae971d5afc631339db0396e90fdb
Contents?: true
Size: 738 Bytes
Versions: 6
Compression:
Stored size: 738 Bytes
Contents
require 'fspath' require 'image_size' require 'image_optim' class ImageOptim class ImagePath < FSPath # Get temp path for this file with same extension def temp_path(*args, &block) ext = extname self.class.temp_file_path([basename(ext), ext], *args, &block) end # Copy file to dest preserving attributes def copy(dst) FileUtils.copy_file(self, dst, true) end # Atomic replace src with self def replace(src) src = self.class.new(src) src.temp_path(src.dirname) do |temp| src.copy(temp) temp.write(read) temp.rename(src) end end # Get format using ImageSize def format open{ |f| ImageSize.new(f) }.format end end end
Version data entries
6 entries across 6 versions & 1 rubygems