Module: Sevgi::Graphics::Mixtures::Underscore

Defined in:
lib/sevgi/graphics/mixtures/underscore.rb

Overview

DSL helpers for floating text, comments, and inherited internal attributes.

Instance Method Summary collapse

Instance Method Details

#_(*contents) ⇒ Sevgi::Graphics::Element

Creates a floating content element.

Parameters:

  • contents (Array<Object>)

    text or content objects

Returns:



11
12
13
# File 'lib/sevgi/graphics/mixtures/underscore.rb', line 11

def _(*contents)
  Element(:_, *contents)
end

#AncestralHash

Merges internal ancestral attributes from the document root to this element.

Returns:

  • (Hash)

    merged internal attributes



24
25
26
27
28
# File 'lib/sevgi/graphics/mixtures/underscore.rb', line 24

def Ancestral
  {}.tap do |result|
    Root().Traverse() { |element| result.merge!(element[:_]) if element.has?(:_) }
  end
end

#Comment(comment) ⇒ Sevgi::Graphics::Element

Adds an XML comment.

Parameters:

  • comment (String)

    comment text

Returns:



18
19
20
# File 'lib/sevgi/graphics/mixtures/underscore.rb', line 18

def Comment(comment)
  _(Content.verbatim("<!-- #{comment} -->"))
end