Sha256: f25372a314fdf4df1546131a86132b9270333f4fed25a98926c142e7e2d6c659

Contents?: true

Size: 696 Bytes

Versions: 14

Compression:

Stored size: 696 Bytes

Contents

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

14 entries across 14 versions & 2 rubygems

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