Class: BridgetownInlineSvg::Tag

Inherits:
Bridgetown::Builder
  • Object
show all
Defined in:
lib/bridgetown-inline-svg/tag.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



3
4
5
# File 'lib/bridgetown-inline-svg/tag.rb', line 3

def attributes
  @attributes
end

#contextObject (readonly)

Returns the value of attribute context.



4
5
6
# File 'lib/bridgetown-inline-svg/tag.rb', line 4

def context
  @context
end

#markupObject (readonly)

Returns the value of attribute markup.



5
6
7
# File 'lib/bridgetown-inline-svg/tag.rb', line 5

def markup
  @markup
end

#svg_pathObject (readonly)

Returns the value of attribute svg_path.



6
7
8
# File 'lib/bridgetown-inline-svg/tag.rb', line 6

def svg_path
  @svg_path
end

Instance Method Details

#buildObject



8
9
10
# File 'lib/bridgetown-inline-svg/tag.rb', line 8

def build
  liquid_tag "svg", :render
end

#render(markup, builder) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/bridgetown-inline-svg/tag.rb', line 12

def render(markup, builder)
  @context = builder.context
  @markup = markup

  interpolate_variables_in_markup!
  set_svg_path_and_attributes!

  return unless svg_path

  add_file_to_dependency!

  render_svg
end