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/pngquant_optimizer.rb,
lib/image_optimizer/image_optimizer_base.rb
Defined Under Namespace
Modules: Shell Classes: GIFOptimizer, ImageOptimizerBase, JPEGOptimizer, PNGOptimizer, PNGQuantOptimizer
Constant Summary collapse
- VERSION =
'1.7.2'
- @@quiet =
Allow the
quiet
flag to be set globally. false
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
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.
22 23 24 25 |
# File 'lib/image_optimizer.rb', line 22 def initialize(path, = {}) @path = path @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
21 22 23 |
# File 'lib/image_optimizer.rb', line 21 def @options end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
21 22 23 |
# File 'lib/image_optimizer.rb', line 21 def path @path end |
Class Method Details
.quiet ⇒ Object
14 15 16 |
# File 'lib/image_optimizer.rb', line 14 def self.quiet @@quiet end |
.quiet=(value) ⇒ Object
17 18 19 |
# File 'lib/image_optimizer.rb', line 17 def self.quiet=(value) @@quiet = value end |
Instance Method Details
#optimize ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/image_optimizer.rb', line 27 def optimize identify_format if [:identify] JPEGOptimizer.new(path, ).optimize PNGOptimizer.new(path, ).optimize PNGQuantOptimizer.new(path, ).optimize GIFOptimizer.new(path, ).optimize end |