Class: DiagramGraph
- Inherits:
-
Object
- Object
- DiagramGraph
- Defined in:
- lib/railroady/diagram_graph.rb
Overview
RailRoady diagram structure
Instance Attribute Summary collapse
-
#alphabetize ⇒ Object
writeonly
Sets the attribute alphabetize.
-
#diagram_type ⇒ Object
writeonly
Sets the attribute diagram_type.
-
#show_label ⇒ Object
writeonly
Sets the attribute show_label.
Instance Method Summary collapse
- #add_edge(edge) ⇒ Object
- #add_node(node) ⇒ Object
-
#initialize ⇒ DiagramGraph
constructor
A new instance of DiagramGraph.
-
#to_dot ⇒ Object
Generate DOT graph.
-
#to_xmi ⇒ Object
Generate XMI diagram (not yet implemented).
Constructor Details
#initialize ⇒ DiagramGraph
Returns a new instance of DiagramGraph.
9 10 11 12 13 14 15 |
# File 'lib/railroady/diagram_graph.rb', line 9 def initialize @diagram_type = '' @show_label = false @alphabetize = false @nodes = [] @edges = [] end |
Instance Attribute Details
#alphabetize=(value) ⇒ Object (writeonly)
Sets the attribute alphabetize
29 30 31 |
# File 'lib/railroady/diagram_graph.rb', line 29 def alphabetize=(value) @alphabetize = value end |
#diagram_type=(value) ⇒ Object (writeonly)
Sets the attribute diagram_type
25 26 27 |
# File 'lib/railroady/diagram_graph.rb', line 25 def diagram_type=(value) @diagram_type = value end |
#show_label=(value) ⇒ Object (writeonly)
Sets the attribute show_label
27 28 29 |
# File 'lib/railroady/diagram_graph.rb', line 27 def show_label=(value) @show_label = value end |
Instance Method Details
#add_edge(edge) ⇒ Object
21 22 23 |
# File 'lib/railroady/diagram_graph.rb', line 21 def add_edge(edge) @edges << edge end |
#add_node(node) ⇒ Object
17 18 19 |
# File 'lib/railroady/diagram_graph.rb', line 17 def add_node(node) @nodes << node end |
#to_dot ⇒ Object
Generate DOT graph
32 33 34 35 36 37 |
# File 'lib/railroady/diagram_graph.rb', line 32 def to_dot dot_header + @nodes.map { |n| dot_node n[0], n[1], n[2], n[3] }.join + @edges.map { |e| dot_edge e[0], e[1], e[2], e[3] }.join + end |
#to_xmi ⇒ Object
Generate XMI diagram (not yet implemented)
40 41 42 43 |
# File 'lib/railroady/diagram_graph.rb', line 40 def to_xmi STDERR.print "Sorry. XMI output not yet implemented.\n\n" '' end |