Sha256: deaed1660f628eed8712feed3ef3b9e21d34a6674d1aa3efed3b3ec50cb6cf4a

Contents?: true

Size: 492 Bytes

Versions: 3

Compression:

Stored size: 492 Bytes

Contents

require 'fspath'
require 'image_size'

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

    # Get format using ImageSize
    def format
      open{ |f| ImageSize.new(f) }.format
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
image_optim-0.2.1 lib/image_optim/image_path.rb
image_optim-0.2.0 lib/image_optim/image_path.rb
image_optim-0.1.0 lib/image_optim/image_path.rb