yuml 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yuml.rb +11 -0
- data/lib/yuml/class.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34a697b99eb1a77a1601afa71051c254514ed67f
|
4
|
+
data.tar.gz: 86578c71f4369cc3d3a725ab00c2a6a0c7c991c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccf54ee2096e03392be4617025b65269018e82be512e0d0d14f5e80d71089eb3b4b163cae15923fe1c6fdd4c21943d3a4e9e7f851c9838c561bad3a98f964bc6
|
7
|
+
data.tar.gz: 80f278c78ce1e56391fa1e116b5bd8dda2db94e5d49cb416232f75287f3e1a65ab79d0216b374433f4da9941ccf4f0aa50119c9609cbbc3456c4f9528cbd9679
|
data/lib/yuml.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
require 'net/http'
|
3
3
|
require 'yuml/class'
|
4
4
|
require 'yuml/relationship'
|
5
|
+
require 'yuml/note'
|
5
6
|
|
6
7
|
# A module to create a DSL for yuml.me
|
7
8
|
module YUML
|
@@ -18,6 +19,7 @@ module YUML
|
|
18
19
|
def generate(options)
|
19
20
|
options = { file: '/tmp/yuml.pdf' }.merge(options)
|
20
21
|
classes.clear
|
22
|
+
notes.clear
|
21
23
|
yield self
|
22
24
|
fetch_uml options[:file]
|
23
25
|
end
|
@@ -29,16 +31,25 @@ module YUML
|
|
29
31
|
yuml_class
|
30
32
|
end
|
31
33
|
|
34
|
+
def attach_note(content, options = {})
|
35
|
+
notes << YUML::Note.create(content, options)
|
36
|
+
end
|
37
|
+
|
32
38
|
private
|
33
39
|
|
34
40
|
def classes
|
35
41
|
@classes ||= []
|
36
42
|
end
|
37
43
|
|
44
|
+
def notes
|
45
|
+
@notes ||= []
|
46
|
+
end
|
47
|
+
|
38
48
|
def yuml
|
39
49
|
uml = classes.map(&:to_s).join(',')
|
40
50
|
relationships = classes.map(&:relationships).compact
|
41
51
|
uml << ',' << relationships.join(',') unless relationships.empty?
|
52
|
+
uml << ',' << notes.join(',') unless notes.empty?
|
42
53
|
URI.encode(uml, encodings)
|
43
54
|
end
|
44
55
|
|
data/lib/yuml/class.rb
CHANGED
@@ -46,6 +46,10 @@ module YUML
|
|
46
46
|
@relationships << "[#{name}]#{relationship}[#{dest.name}]"
|
47
47
|
end
|
48
48
|
|
49
|
+
def attach_note(content, options = {})
|
50
|
+
@relationships << "[#{name}]-#{YUML::Note.create(content, options)}"
|
51
|
+
end
|
52
|
+
|
49
53
|
def to_s
|
50
54
|
"[#{name}#{variables}#{methods}]"
|
51
55
|
end
|