Class: Rumld::Tree
Instance Attribute Summary collapse
-
#constant_names ⇒ Object
readonly
Returns the value of attribute constant_names.
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
Instance Method Summary collapse
- #all_nodes ⇒ Object
-
#initialize(graph, constant_names = []) ⇒ Tree
constructor
A new instance of Tree.
- #node_for(constant) ⇒ Object
- #nodes ⇒ Object
- #to_dot ⇒ Object
Constructor Details
#initialize(graph, constant_names = []) ⇒ Tree
5 6 7 8 9 |
# File 'lib/rumld/tree.rb', line 5 def initialize( graph, constant_names = []) @graph = graph @constant_names = constant_names.uniq.sort build_nodes end |
Instance Attribute Details
#constant_names ⇒ Object (readonly)
Returns the value of attribute constant_names.
4 5 6 |
# File 'lib/rumld/tree.rb', line 4 def constant_names @constant_names end |
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
4 5 6 |
# File 'lib/rumld/tree.rb', line 4 def graph @graph end |
Instance Method Details
#all_nodes ⇒ Object
25 26 27 |
# File 'lib/rumld/tree.rb', line 25 def all_nodes nodes.collect{|n| n.self_and_descendants}.flatten end |
#node_for(constant) ⇒ Object
29 30 31 |
# File 'lib/rumld/tree.rb', line 29 def node_for( constant ) all_nodes.detect{|node| node.constant == constant || node.constant_name == constant} end |
#nodes ⇒ Object
21 22 23 |
# File 'lib/rumld/tree.rb', line 21 def nodes @nodes ||= [] end |
#to_dot ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/rumld/tree.rb', line 11 def to_dot %(digraph uml_diagram {\n graph[rotate=landscape, ratio=fill, overlap=false, splines=true] #{draw_nodes} #{draw_included_modules} #{draw_associations} #{draw_inheritence_edges} } ) end |