Class: ImageOptim::OptimizedPath
- Defined in:
- lib/image_optim/optimized_path.rb
Overview
Holds optimized image with reference to original and its size
Constant Summary
Constants inherited from Path
Instance Attribute Summary collapse
-
#original ⇒ Object
readonly
Original path, use original_size to get its size as original can be overwritten.
-
#original_size ⇒ Object
readonly
Stored size of original.
Instance Method Summary collapse
-
#initialize(path, original_or_size = nil) ⇒ OptimizedPath
constructor
A new instance of OptimizedPath.
Methods inherited from Path
convert, #copy, #copy_metadata, #image_format, #move, #replace, #temp_path
Constructor Details
#initialize(path, original_or_size = nil) ⇒ OptimizedPath
Returns a new instance of OptimizedPath.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/image_optim/optimized_path.rb', line 10 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 |
Instance Attribute Details
#original ⇒ Object (readonly)
Original path, use original_size to get its size as original can be overwritten
24 25 26 |
# File 'lib/image_optim/optimized_path.rb', line 24 def original @original end |
#original_size ⇒ Object (readonly)
Stored size of original
27 28 29 |
# File 'lib/image_optim/optimized_path.rb', line 27 def original_size @original_size end |