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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9f04365d3826f8450528e516bd39e4bd0391e9c
4
- data.tar.gz: 2b53c462d1e46c64040158d0e2201d8c5dfb3882
3
+ metadata.gz: 1c6fef94c6462575c95cbfdbbbe293a1cd8d0dfd
4
+ data.tar.gz: 9acbe49f4175cae128234b0b44c606aad4762f7b
5
5
  SHA512:
6
- metadata.gz: 1bed183f513c49fe84a87c3030cfd9f7a1d698957a4f677c4811b32deb8e2d6a98ea6c53b525b338c544b911f3bc0406a39d844cc79402b29843121f68bddc51
7
- data.tar.gz: c1d68e431f2abef26170de087803fe579243f53e1a77e44f31dc43306f856fac7459dcaf1daf495d91d2282f195e24769615ef6c7b1c5413ac221305238095a0
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
@@ -12,18 +12,31 @@ module YUML
12
12
  end
13
13
 
14
14
  def composition(*args)
15
- "+#{aggregation(*args)}"
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 == 2
21
- "+#{args[0]}-#{args[1]}>"
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.1
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-20 00:00:00.000000000 Z
11
+ date: 2016-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec