yuml 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/yuml/class.rb +8 -0
- data/lib/yuml/relationship.rb +21 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c6fef94c6462575c95cbfdbbbe293a1cd8d0dfd
|
4
|
+
data.tar.gz: 9acbe49f4175cae128234b0b44c606aad4762f7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2170fe261a250a4787591e1938eb141d99f13d184e748fa33877b282a31d25409597355ce681629fb22fd29d8b2c785d74d8a9b7334d626a86ac05bc25444d47
|
7
|
+
data.tar.gz: 5579390bde42356b29a6c6cef2c552b20eda8be66f3aa542aa1be405fe6fb94193d1a37921553422cc961b65de8fea2bc19441459dcc43d5a8e9069c5a3d416e
|
data/lib/yuml/class.rb
CHANGED
@@ -38,6 +38,14 @@ module YUML
|
|
38
38
|
@relationships << "[#{dest.name}]#{relationship}[#{name}]"
|
39
39
|
end
|
40
40
|
|
41
|
+
def associated_with(dest, options = {})
|
42
|
+
options[:type] = :directed_assoication unless %i(
|
43
|
+
association directed_assoication two_way_association dependency
|
44
|
+
).include?(options[:type])
|
45
|
+
relationship = YUML::Relationship.send(options[:type], options[:cardinality])
|
46
|
+
@relationships << "[#{name}]#{relationship}[#{dest.name}]"
|
47
|
+
end
|
48
|
+
|
41
49
|
def to_s
|
42
50
|
"[#{name}#{variables}#{methods}]"
|
43
51
|
end
|
data/lib/yuml/relationship.rb
CHANGED
@@ -12,18 +12,31 @@ module YUML
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def composition(*args)
|
15
|
-
"
|
15
|
+
"++#{association(*args)}>"
|
16
16
|
end
|
17
17
|
|
18
18
|
def aggregation(*args)
|
19
|
+
"+#{association(*args)}>"
|
20
|
+
end
|
21
|
+
|
22
|
+
def two_way_association(*args)
|
23
|
+
"<#{association(*args)}>"
|
24
|
+
end
|
25
|
+
|
26
|
+
def directed_assoication(*args)
|
27
|
+
"#{association(*args)}>"
|
28
|
+
end
|
29
|
+
|
30
|
+
def association(*args)
|
31
|
+
args.flatten!
|
32
|
+
return "-#{args.first}" if args.size == 1
|
33
|
+
"#{args.first}-#{args.last}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def dependency(*args)
|
19
37
|
args.flatten!
|
20
|
-
if args.size ==
|
21
|
-
|
22
|
-
elsif args.size == 1
|
23
|
-
"+-#{args.first}>"
|
24
|
-
else
|
25
|
-
'+->'
|
26
|
-
end
|
38
|
+
return "-.-#{args.first}>" if args.size == 1
|
39
|
+
"#{args.first}-.-#{args.last}>"
|
27
40
|
end
|
28
41
|
end
|
29
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yuml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derek Stride
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|