Class: Architect::Class
Instance Attribute Summary collapse
-
#graphnode ⇒ Object
Returns the value of attribute graphnode.
-
#markup ⇒ Object
Returns the value of attribute markup.
Attributes inherited from Node
Instance Method Summary collapse
- #format(markup) ⇒ Object
- #graph(g) ⇒ Object
-
#initialize(markup) ⇒ Class
constructor
A new instance of Class.
Methods inherited from Node
Constructor Details
#initialize(markup) ⇒ Class
Returns a new instance of Class.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/architect/class.rb', line 9 def initialize(markup) if markup.index("|").nil? @name = markup else tokens = /^(?<name>.+?)\|/.match(markup) @name = tokens[:name] end @markup = format(markup) @style = {shape: "record"} end |
Instance Attribute Details
#graphnode ⇒ Object
Returns the value of attribute graphnode.
7 8 9 |
# File 'lib/architect/class.rb', line 7 def graphnode @graphnode end |
#markup ⇒ Object
Returns the value of attribute markup.
7 8 9 |
# File 'lib/architect/class.rb', line 7 def markup @markup end |
Instance Method Details
#format(markup) ⇒ Object
20 21 22 |
# File 'lib/architect/class.rb', line 20 def format(markup) return "{" + markup.gsub(";", "\\n") + "}" end |
#graph(g) ⇒ Object
24 25 26 |
# File 'lib/architect/class.rb', line 24 def graph(g) @graphnode = g.add_nodes(@markup, @style) end |