Module: Xumlidot::Diagram::Dot::Klass
Instance Method Summary
collapse
#draw_ancestor, #draw_identifier, #draw_name
Instance Method Details
#draw ⇒ Object
30
31
32
|
# File 'lib/xumlidot/diagram/dot/klass.rb', line 30
def draw
[draw_klass].compact.join('\r\n')
end
|
#draw_composition(composee) ⇒ Object
39
40
41
42
43
|
# File 'lib/xumlidot/diagram/dot/klass.rb', line 39
def draw_composition(composee)
"\"#{draw_identifier(composee.definition)}\"" \
" -> \"#{draw_identifier(@definition)}\"" \
' [label="", arrowhead="diamond", arrowtail="diamond"]'
end
|
#draw_inheritance ⇒ Object
rubocop:disable Metrics/AbcSize
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/xumlidot/diagram/dot/klass.rb', line 45
def draw_inheritance return nil if @definition.superklass.empty? && @definition.inherited_modules.empty?
dot = ''
unless @definition.superklass.empty?
dot += "\"#{draw_identifier(@definition)}\"" \
" -> \"#{draw_ancestor(@definition.superklass)}\"" \
" [label=\"\", arrowhead=\"empty\", arrowtail=\"onormal\"]\n"
end
return dot if @definition.inherited_modules.empty?
@definition.inherited_modules.each do |m|
next if m.empty?
dot += "\"#{draw_identifier(@definition)}\"" \
" -> \"#{draw_ancestor(m)}\"" \
" [label=\"#{m.type}s\", arrowhead=\"empty\", arrowtail=\"onormal\"]\n"
end
dot
end
|
#draw_klass ⇒ Object
34
35
36
37
|
# File 'lib/xumlidot/diagram/dot/klass.rb', line 34
def draw_klass
label = draw_identifier(@definition)
"\"#{draw_identifier(@definition)}\" [shape=Mrecord, label=\"{#{label}|#{draw_methods}}\"]"
end
|