Class: Lutaml::Ea::Diagram::ElementRenderers::BaseRenderer
- Inherits:
-
Object
- Object
- Lutaml::Ea::Diagram::ElementRenderers::BaseRenderer
- Defined in:
- lib/lutaml/ea/diagram/element_renderers/base_renderer.rb
Overview
Base renderer for diagram elements
Direct Known Subclasses
Instance Attribute Summary collapse
-
#element ⇒ Object
readonly
Returns the value of attribute element.
-
#style_parser ⇒ Object
readonly
Returns the value of attribute style_parser.
Instance Method Summary collapse
-
#initialize(element, style_parser) ⇒ BaseRenderer
constructor
A new instance of BaseRenderer.
-
#render ⇒ String
Render the element as SVG.
Constructor Details
#initialize(element, style_parser) ⇒ BaseRenderer
Returns a new instance of BaseRenderer.
11 12 13 14 |
# File 'lib/lutaml/ea/diagram/element_renderers/base_renderer.rb', line 11 def initialize(element, style_parser) @element = element @style_parser = style_parser end |
Instance Attribute Details
#element ⇒ Object (readonly)
Returns the value of attribute element.
9 10 11 |
# File 'lib/lutaml/ea/diagram/element_renderers/base_renderer.rb', line 9 def element @element end |
#style_parser ⇒ Object (readonly)
Returns the value of attribute style_parser.
9 10 11 |
# File 'lib/lutaml/ea/diagram/element_renderers/base_renderer.rb', line 9 def style_parser @style_parser end |
Instance Method Details
#render ⇒ String
Render the element as SVG
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/lutaml/ea/diagram/element_renderers/base_renderer.rb', line 18 def render style = style_parser.parse_element_style(element) <<~SVG <g class="lutaml-diagram-element lutaml-diagram-#{element[:type]}" data-element-id="#{element[:id]}" data-element-type="#{element[:type]}"> #{render_shape(style)} #{render_label(style)} </g> SVG end |