Module: Sevgi::Derender::Elements::Root Private

Includes:
Any
Defined in:
lib/sevgi/derender/elements/root.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Element strategy for the SVG root element.

Instance Method Summary collapse

Instance Method Details

#attributes!Hash{String => String}

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns root attributes merged with namespace declarations.

Returns:

  • (Hash{String => String})

    attributes and namespaces



34
# File 'lib/sevgi/derender/elements/root.rb', line 34

def attributes! = {**attributes, **namespaces}

#decompile(pres = []) ⇒ Array<String>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Converts the SVG root into unformatted Sevgi DSL lines.

Parameters:

  • pres (Array<String>) (defaults to: [])

    preamble XML lines

Returns:

  • (Array<String>)

    unformatted Ruby source lines



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/sevgi/derender/elements/root.rb', line 14

def decompile(pres = [])
  lines = super
  return lines unless pres&.any?

  lines.unshift(
    [
      "SVG.document preambles: [",
      *pres.map { "#{Ruby.literal(it)}," },
      "]",
      ""
    ]
  )
end

#elementString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the root DSL word.

Returns:

  • (String)


30
# File 'lib/sevgi/derender/elements/root.rb', line 30

def element = "SVG"