Class: Ea::Svg::ConnectorPath
- Inherits:
-
Object
- Object
- Ea::Svg::ConnectorPath
- Defined in:
- lib/ea/svg/connector_path.rb
Overview
Renders one DiagramConnector as an SVG
Constant Summary collapse
- ARROW_SIZE =
8
Instance Attribute Summary collapse
-
#connector ⇒ Object
readonly
Returns the value of attribute connector.
-
#relationship ⇒ Object
readonly
Returns the value of attribute relationship.
Instance Method Summary collapse
-
#initialize(connector, relationship: nil) ⇒ ConnectorPath
constructor
A new instance of ConnectorPath.
- #render ⇒ Object
Constructor Details
#initialize(connector, relationship: nil) ⇒ ConnectorPath
Returns a new instance of ConnectorPath.
14 15 16 17 |
# File 'lib/ea/svg/connector_path.rb', line 14 def initialize(connector, relationship: nil) @connector = connector @relationship = relationship end |
Instance Attribute Details
#connector ⇒ Object (readonly)
Returns the value of attribute connector.
12 13 14 |
# File 'lib/ea/svg/connector_path.rb', line 12 def connector @connector end |
#relationship ⇒ Object (readonly)
Returns the value of attribute relationship.
12 13 14 |
# File 'lib/ea/svg/connector_path.rb', line 12 def relationship @relationship end |
Instance Method Details
#render ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ea/svg/connector_path.rb', line 19 def render points = waypoints return "" if points.size < 2 path_d = build_path_d(points) style = StyleResolver.new(connector.style) parts = [] parts << %(<g class="connector" data-connector-id="#{escape(connector.id)}">) parts << %( <path d="#{path_d}" stroke="#{style.stroke_color}" stroke-width="#{style.stroke_width}" fill="none"/>) parts << render_source_marker(points) if source_marker? parts << render_target_marker(points) parts << %(</g>) parts.join("\n ") end |