Class: SyntaxTree::Mermaid::Link
- Inherits:
-
Object
- Object
- SyntaxTree::Mermaid::Link
- Defined in:
- lib/syntax_tree/mermaid.rb
Overview
This class represents a link between two nodes in a flowchart. It is not meant to be interacted with directly, but rather used as a data structure by the FlowChart class.
Constant Summary collapse
- TYPES =
%i[directed dotted].freeze
- COLORS =
%i[green red].freeze
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(from, to, label, type, color) ⇒ Link
constructor
A new instance of Link.
- #render ⇒ Object
Constructor Details
#initialize(from, to, label, type, color) ⇒ Link
Returns a new instance of Link.
84 85 86 87 88 89 90 91 92 93 |
# File 'lib/syntax_tree/mermaid.rb', line 84 def initialize(from, to, label, type, color) raise unless TYPES.include?(type) raise if color && !COLORS.include?(color) @from = from @to = to @label = label @type = type @color = color end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
82 83 84 |
# File 'lib/syntax_tree/mermaid.rb', line 82 def color @color end |
#from ⇒ Object (readonly)
Returns the value of attribute from.
82 83 84 |
# File 'lib/syntax_tree/mermaid.rb', line 82 def from @from end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
82 83 84 |
# File 'lib/syntax_tree/mermaid.rb', line 82 def label @label end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
82 83 84 |
# File 'lib/syntax_tree/mermaid.rb', line 82 def to @to end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
82 83 84 |
# File 'lib/syntax_tree/mermaid.rb', line 82 def type @type end |