Sha256: 2230383c654818d9e8b5c370c4c7c9b0abb6f7d1a20acb871863c5da2ca2d1cb

Contents?: true

Size: 727 Bytes

Versions: 2

Compression:

Stored size: 727 Bytes

Contents

# frozen_string_literal: true

require 'image_optim/path'

class ImageOptim
  # Holds optimized image with reference to original and its size
  class OptimizedPath < DelegateClass(Path)
    def initialize(path, original_or_size = nil)
      path = Path.convert(path)
      __setobj__(path)
      if original_or_size.is_a?(Integer)
        @original = path
        @original_size = original_or_size
      elsif original_or_size
        @original = Path.convert(original_or_size)
        @original_size = @original.size
      end
    end

    # Original path, use original_size to get its size as original can be
    # overwritten
    attr_reader :original

    # Stored size of original
    attr_reader :original_size
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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