lib/image_optim/runner.rb in image_optim-0.19.1 vs lib/image_optim/runner.rb in image_optim-0.20.0
- old
+ new
@@ -44,10 +44,11 @@
end
def initialize(options)
options = HashHelpers.deep_symbolise_keys(options)
@recursive = options.delete(:recursive)
+ @progress = options.delete(:show_progress) != false
@exclude_dir_globs, @exclude_file_globs = %w[dir file].map do |type|
glob = options.delete(:"exclude_#{type}_glob") || '.*'
GlobHelpers.expand_braces(glob)
end
@image_optim = ImageOptim.new(options)
@@ -69,11 +70,11 @@
end
private
def optimize_images!(to_optimize, &block)
- @image_optim.
- optimize_images!(to_optimize.with_progress('optimizing'), &block)
+ to_optimize = to_optimize.with_progress('optimizing') if @progress
+ @image_optim.optimize_images!(to_optimize, &block)
end
def find_to_optimize(paths)
to_optimize = []
paths.each do |path|