Class: Jekyll::Assets::Plugins::MiniMagick

Inherits:
Jekyll::Assets::Proxy show all
Defined in:
lib/jekyll/assets/plugins/proxy/magick.rb

Defined Under Namespace

Classes: SameType

Instance Attribute Summary

Attributes inherited from Jekyll::Assets::Proxy

#file

Attributes inherited from Extensible

#args, #asset, #ctx, #env, #jekyll

Instance Method Summary collapse

Methods inherited from Jekyll::Assets::Proxy

args_key, copy, digest, #initialize, keys, proxies_for, proxy

Methods inherited from Extensible

for?, for_args?, for_type?, inherited, #initialize, internal!, internal?, requirements

Constructor Details

This class inherits a constructor from Jekyll::Assets::Proxy

Instance Method Details

#processObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/jekyll/assets/plugins/proxy/magick.rb', line 20

def process
  img = ::MiniMagick::Image.new(@file)
  magick_format(img) if @args[:magick][:format]
  img.combine_options do |c|
    @args[:magick].keys.reject { |k| k == :format }.each do |k|
      m = "magick_#{k}"

      if respond_to?(m, true)
        method(m).arity == 2 ? send(m, img, c) : send(m, c)
      end
    end
  end

  @file
ensure
  img&.destroy!
end

#runnersObject



38
39
40
41
42
# File 'lib/jekyll/assets/plugins/proxy/magick.rb', line 38

def runners
  private_methods(true).select do |v|
    v =~ %r!^magick_! && v != :magick_format
  end
end