Class: Sevgi::Graphics::Document::Proto

Inherits:
Element
  • Object
show all
Defined in:
lib/sevgi/graphics/document.rb

Overview

Base document root element class.

Direct Known Subclasses

Base

Constant Summary

Constants inherited from Element

Element::RootParent

Instance Attribute Summary

Attributes inherited from Element

#attributes, #children, #contents, #name, #parent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Element

element, #initialize, #method_missing, #respond_to_missing?, root, root?, valid?

Methods included from Element::Ident

#id

Constructor Details

This class inherits a constructor from Sevgi::Graphics::Element

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Sevgi::Graphics::Element

Class Method Details

.attributesHash{Symbol => Object}

Returns inherited root attributes for this document class.

Returns:

  • (Hash{Symbol => Object})

    inherited root attributes



379
# File 'lib/sevgi/graphics/document.rb', line 379

def self.attributes = self == Proto ? {} : {**superclass.attributes, **profile.attributes}

.preamblesArray<String>?

Returns inherited preamble lines for this document class.

Returns:

  • (Array<String>, nil)


383
# File 'lib/sevgi/graphics/document.rb', line 383

def self.preambles = self == Proto ? nil : profile.preambles || superclass.preambles

Instance Method Details

#call(*objects, **options) ⇒ String

Renders the document.

Parameters:

  • objects (Array<Object>)

    optional renderer arguments

  • options (Hash)

    render options

Returns:

  • (String)

    SVG document source

Raises:

  • (Sevgi::ArgumentError)

    when renderer options or XML-bound values are invalid



369
370
371
372
373
374
375
# File 'lib/sevgi/graphics/document.rb', line 369

def call(*, **)
  options = DEFAULTS.merge(**)

  self.PreRender(*, **options) if respond_to?(:PreRender)
  render_options = options.reject { |key, _| DEFAULTS.key?(key) }
  self.Render(*, **render_options)
end