lib/jekyll/favicon/utils/convert.rb in jekyll-favicon-1.0.0.pre.1 vs lib/jekyll/favicon/utils/convert.rb in jekyll-favicon-1.0.0.pre.2
- old
+ new
@@ -1,39 +1,36 @@
# frozen_string_literal: true
-require 'mini_magick'
+require "mini_magick"
module Jekyll
module Favicon
module Utils
# Favicon convert for include
module Convert
def self.included(klass)
klass.extend(ClassMethods)
end
+ def self.convert_apply(convert, options = {})
+ options.each_with_object(convert) do |(option, value), memo|
+ memo.send option.to_sym, value
+ end
+ end
+
+ def self.convert_options(convert, options = {})
+ priorities = %w[resize scale]
+ convert_apply convert, options.slice(*priorities)
+ common_options = options.reject { |key| priorities.include? key }
+ convert_apply convert, common_options
+ end
+
# Favicon convert utils functions
module ClassMethods
def convert(input, output, options = {})
MiniMagick::Tool::Convert.new do |convert|
convert.flatten
- convert_options(convert, options) << input << output
- end
- end
-
- private
-
- def convert_options(convert, options = {})
- priorities = %w[resize scale]
- convert_apply convert, options.slice(*priorities)
- common_options = options.reject { |key| priorities.include? key }
- convert_apply convert, common_options
- end
-
- # :reek:UtilityFunction
- def convert_apply(convert, options = {})
- options.each_with_object(convert) do |(option, value), memo|
- memo.send option.to_sym, value
+ Convert.convert_options(convert, options) << input << output
end
end
end
end
end