lib/image_optim/worker/optipng.rb in image_optim-0.13.3 vs lib/image_optim/worker/optipng.rb in image_optim-0.14.0

- old
+ new

@@ -2,13 +2,24 @@ require 'image_optim/option_helpers' require 'image_optim/true_false_nil' class ImageOptim class Worker + # http://optipng.sourceforge.net/ class Optipng < Worker - option(:level, 6, 'Optimization level preset: `0` is least, `7` is best'){ |v| OptionHelpers.limit_with_range(v.to_i, 0..7) } + LEVEL_OPTION = + option(:level, 6, 'Optimization level preset: '\ + '`0` is least, '\ + '`7` is best') do |v| + OptionHelpers.limit_with_range(v.to_i, 0..7) + end - option(:interlace, false, TrueFalseNil, 'Interlace, `true` - interlace on, `false` - interlace off, `nil` - as is in original image') do |v| + INTERLACE_OPTION = + option(:interlace, false, TrueFalseNil, 'Interlace, '\ + '`true` - interlace on, '\ + '`false` - interlace off, '\ + '`nil` - as is in original image') do |v| + # convert everything truthy to `true`, leave `false` and `nil` as is v && true end def optimize(src, dst) src.copy(dst)