Sha256: 255ac8911ebcaf3acb57d77bf0ca747f03a3c63306cb64cb5c4d3ec76ccb28b8

Contents?: true

Size: 722 Bytes

Versions: 7

Compression:

Stored size: 722 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)
      super(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

7 entries across 7 versions & 1 rubygems

Version Path
image_optim-0.31.1 lib/image_optim/optimized_path.rb
image_optim-0.31.0 lib/image_optim/optimized_path.rb
image_optim-0.30.0 lib/image_optim/optimized_path.rb
image_optim-0.29.0 lib/image_optim/optimized_path.rb
image_optim-0.28.0 lib/image_optim/optimized_path.rb
image_optim-0.27.1 lib/image_optim/optimized_path.rb
image_optim-0.27.0 lib/image_optim/optimized_path.rb