Sha256: ebcc0579289bf05ee26ddfd00ea2791f362df4c16dd77317ffb22cd3db91759d
Contents?: true
Size: 842 Bytes
Versions: 6
Compression:
Stored size: 842 Bytes
Contents
class ImageOptimizer class ImageOptimizerBase include Shell attr_reader :path, :options def initialize(path, options = {}) @path = path @options = options end def optimize return unless correct_format? if optimizer_bin? perform_optimizations else warn "Attempting to optimize a #{type} without #{bin_name} installed. Skipping..." end end private def correct_format? extensions.include?(options[:identified_format] || extension(path)) end def extension(path) path.split('.').last.downcase end def perform_optimizations system(optimizer_bin, *command_options) end def optimizer_bin? !!optimizer_bin end def optimizer_bin ENV["#{bin_name.upcase}_BIN"] || which(bin_name) end end end
Version data entries
6 entries across 6 versions & 1 rubygems