Module: UmlBuilder

Included in:
DotBuilder
Defined in:
lib/uml/uml_builder.rb

Overview

Contract: Classes that include UmlBuilder must implement the following methods:

  • build_entity(vertex)

  • build_relation(vertex, edge, vertex)

Instance Method Summary collapse

Instance Method Details

#build_uml(graph) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/uml/uml_builder.rb', line 12

def build_uml graph
  content = ''
  content << build_header if self.respond_to? :build_header
  graph.each do |vertex|
    content << build_entity(vertex) unless @exclude.include? vertex.name
  end

  graph.each do |vertex|
    vertex.each do |edge, set|
      unless @exclude.include? vertex.name
        set.each do |o_vertex|
          content << build_relation(vertex, edge.type, o_vertex) unless @exclude.include? o_vertex.name
        end
      end
    end
  end
  content << build_footer if self.respond_to? :build_footer
  content
end

#initialize(config = {}) ⇒ Object



7
8
9
10
# File 'lib/uml/uml_builder.rb', line 7

def initialize config={}
  @config = config
  @exclude = config['exclude'] || []
end