marmerdo 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/lib/marmerdo/domain_diagram_generator.rb +1 -1
- data/lib/marmerdo/node.rb +1 -0
- data/lib/marmerdo/relationship.rb +29 -23
- data/lib/marmerdo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75e6024f088234f63afcedd06d33ca186beb1b13f0736b39f015027341930b7a
|
4
|
+
data.tar.gz: 6366471bac61e54a3203fa00f9076902e1312314668052f2382e3c13ceef19a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8c2114f14742c25fde0c4b8c455a843fbd28af00cad65a1a45a09d57f74575d116366daa2a05367a32f720edd31f153eacf403b718de74c35fef9df780784bc
|
7
|
+
data.tar.gz: 8c042444b75adff10d17cc72d4c882ccb70cf1274a7ba0bbba1aa263b27a1fe4dde4863a1d325a72308f5b2be0015bf1ca9a22b6fc6549a8db735b67754e5b2a
|
data/CHANGELOG.md
CHANGED
data/lib/marmerdo/node.rb
CHANGED
@@ -21,6 +21,7 @@ module Marmerdo
|
|
21
21
|
def generate_mermaid_link(output_path)
|
22
22
|
output_dir = Pathname.new(output_path).dirname
|
23
23
|
relative_path = Pathname.new(path).relative_path_from(output_dir).to_s
|
24
|
+
relative_path = "./#{relative_path}" unless relative_path.start_with?("../")
|
24
25
|
"link #{name} \"#{relative_path}\""
|
25
26
|
end
|
26
27
|
end
|
@@ -19,7 +19,7 @@ module Marmerdo
|
|
19
19
|
# @return [Symbol]
|
20
20
|
attr_reader :type
|
21
21
|
|
22
|
-
# @return [Symbol]
|
22
|
+
# @return [Array<Symbol>]
|
23
23
|
attr_reader :to
|
24
24
|
|
25
25
|
def self.valid_type?(type)
|
@@ -28,30 +28,36 @@ module Marmerdo
|
|
28
28
|
|
29
29
|
def initialize(type:, to:)
|
30
30
|
@type = type.to_sym
|
31
|
-
@to = to.
|
31
|
+
@to = if to.is_a?(Array)
|
32
|
+
to.map(&:to_sym)
|
33
|
+
else
|
34
|
+
[to.to_sym]
|
35
|
+
end
|
32
36
|
end
|
33
37
|
|
34
|
-
def
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
38
|
+
def to_mermaid_str(from)
|
39
|
+
to.map do |t|
|
40
|
+
case type
|
41
|
+
when :inheritance
|
42
|
+
"#{t} <|-- #{from}"
|
43
|
+
when :composition
|
44
|
+
"#{t} *-- #{from}"
|
45
|
+
when :aggregation
|
46
|
+
"#{t} o-- #{from}"
|
47
|
+
when :association
|
48
|
+
"#{from} --> #{t}"
|
49
|
+
when :link_solid
|
50
|
+
"#{from} -- #{t}"
|
51
|
+
when :dependency
|
52
|
+
"#{from} ..> #{t}"
|
53
|
+
when :realization
|
54
|
+
"#{from} ..|> #{t}"
|
55
|
+
when :link_dashed
|
56
|
+
"#{from} .. #{t}"
|
57
|
+
else
|
58
|
+
raise UnknownRelationshipType
|
59
|
+
end
|
60
|
+
end.join("\n")
|
55
61
|
end
|
56
62
|
end
|
57
63
|
end
|
data/lib/marmerdo/version.rb
CHANGED