Class: Ea::Svg::ConnectorPath

Inherits:
Object
  • Object
show all
Defined in:
lib/ea/svg/connector_path.rb

Overview

Renders one DiagramConnector as an SVG through its waypoints. Arrowheads and per-direction routing are future work; today we emit a straight-segment polyline matching the source layout.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connector) ⇒ ConnectorPath

Returns a new instance of ConnectorPath.



12
13
14
# File 'lib/ea/svg/connector_path.rb', line 12

def initialize(connector)
  @connector = connector
end

Instance Attribute Details

#connectorObject (readonly)

Returns the value of attribute connector.



10
11
12
# File 'lib/ea/svg/connector_path.rb', line 10

def connector
  @connector
end

Instance Method Details

#renderObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/ea/svg/connector_path.rb', line 16

def render
  points = waypoints
  return "" if points.empty?

  <<~SVG.chomp
    <polyline points="#{points.join(' ')}"
              fill="none" stroke="#{stroke_color}"
              stroke-width="#{stroke_width}"/>
  SVG
end