Class: ImageOptimizer
- Inherits:
-
Object
- Object
- ImageOptimizer
- Includes:
- Shell
- Defined in:
- lib/image_optimizer.rb,
lib/image_optimizer/shell.rb,
lib/image_optimizer/version.rb,
lib/image_optimizer/gif_optimizer.rb,
lib/image_optimizer/png_optimizer.rb,
lib/image_optimizer/jpeg_optimizer.rb,
lib/image_optimizer/image_optimizer_base.rb
Defined Under Namespace
Modules: Shell Classes: GIFOptimizer, ImageOptimizerBase, JPEGOptimizer, PNGOptimizer
Constant Summary collapse
- VERSION =
'1.6.0'
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path, options = {}) ⇒ ImageOptimizer
constructor
A new instance of ImageOptimizer.
- #optimize ⇒ Object
Methods included from Shell
included, #run_command, #which
Constructor Details
#initialize(path, options = {}) ⇒ ImageOptimizer
Returns a new instance of ImageOptimizer.
12 13 14 15 |
# File 'lib/image_optimizer.rb', line 12 def initialize(path, = {}) @path = path @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/image_optimizer.rb', line 11 def @options end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
11 12 13 |
# File 'lib/image_optimizer.rb', line 11 def path @path end |
Instance Method Details
#optimize ⇒ Object
17 18 19 20 21 22 |
# File 'lib/image_optimizer.rb', line 17 def optimize identify_format if [:identify] JPEGOptimizer.new(path, ).optimize PNGOptimizer.new(path, ).optimize GIFOptimizer.new(path, ).optimize end |