Class: Jekyll::Assets::HTML::SVG

Inherits:
Jekyll::Assets::HTML show all
Defined in:
lib/jekyll/assets/plugins/html/svg.rb

Instance Attribute Summary

Attributes inherited from Jekyll::Assets::HTML

#doc

Attributes inherited from Extensible

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Jekyll::Assets::HTML

build, #initialize, make_doc, skips

Methods inherited from Extensible

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

Constructor Details

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

Class Method Details

.for?(type:, args:) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
30
31
32
33
# File 'lib/jekyll/assets/plugins/html/svg.rb', line 27

def self.for?(type:, args:)
  return false unless super
  return false unless args.key?(:inline) &&
      !args.key?(:srcset)

  true
end

.wants_xml?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/jekyll/assets/plugins/html/svg.rb', line 22

def self.wants_xml?
  true
end

Instance Method Details

#runObject



14
15
16
17
18
19
# File 'lib/jekyll/assets/plugins/html/svg.rb', line 14

def run
  arg = @args.to_h(html: true)
  arg.each do |k, v|
    @doc.set_attribute(k, v)
  end
end