yuml 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08d748325a616407967febe42befb19be51ca4b6
4
- data.tar.gz: 3366bcee2cb3dd6009a426a4e5114859ecaa5003
3
+ metadata.gz: d301a5a94555df94b0aeb705e58c0e18d10b2f29
4
+ data.tar.gz: 2058b126b7b21ff0e81b627ec18b533f6aa6d171
5
5
  SHA512:
6
- metadata.gz: b7720f885df0dd8fe38d71223c7c8e221d30fc867435fde0e8554cba425413e5790dd8abd5d2c04f8d99c2930dbe1d996cfbba85926378ea0ee8fc75f3de7cd5
7
- data.tar.gz: 11ff15392add8a1c50919e6badddd4bedc8996573958cd12e55c383b04d52430c0c592c25c29f16c717c488e35905b11f5345e648fd650c847e231604e8a7ddb
6
+ metadata.gz: 01756670bbb5f097a1e90fcbb872483ccc09156b923928da5d2850d811873d688c78355d3e86655d8cff1d67d6ee3773bb7c2d26f51ba8904eec0c24a91e959e
7
+ data.tar.gz: 7ea6a585f33b5edf0c521ea7f017271cdbd5c0f3d70782cf64aa6ab13ec6dc2cdcc29d322ea5c2f7ebba3b2075e3d3cf589bae42cbd1f928446412effe8b161b
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # yuml
1
+ # The UML DSL
2
2
 
3
- A Ruby DSL for generating UML built on yuml.me
3
+ A Ruby DSL for generating UML built on yuml.me, visit the [homepage](http://derekstride.io/yuml/) to learn more.
4
4
 
5
5
  ## Getting Started
6
6
 
7
- To build a UML document start with this block of code. Everything inside the block will be used to descibe the uml document you want to create.
7
+ To build a UML document start with this block of code. Everything inside the block will be used to describe the uml document you want to create.
8
8
 
9
9
  ```ruby
10
10
  YUML.generate(file: 'tmp.pdf') do |uml|
@@ -16,13 +16,10 @@ end
16
16
 
17
17
  To generate a class for the document use `uml.class` and pass a code block in to configure it. It accepts the following methods for configuration.
18
18
 
19
- * `name(name = nil)` (required)
20
- * `interface(interface = nil, sterotype = 'interface')`*
19
+ * `name(name = nil, prototype = nil)` (required)
21
20
  * `variables(*args)`
22
21
  * `methods(*args)`
23
22
 
24
- \*use `interface` in place of `name` when generating an interface
25
-
26
23
  #### Example
27
24
 
28
25
  ```ruby
@@ -39,7 +36,7 @@ end
39
36
 
40
37
  ```ruby
41
38
  shape = uml.class do
42
- interface 'Shape', 'module'
39
+ name 'Shape', 'module'
43
40
  methods '+draw(id: int, content: String, style: Symbol)'
44
41
  end
45
42
  ```
@@ -66,13 +63,13 @@ document.has_a(picture, cardinality: '0..*')
66
63
  document.is_a(content)
67
64
 
68
65
  picture.is_a(content, type: :interface)
69
- content.associated_with(content, type: dependency)
70
- document.attach_note('This is a document', color: :green)
66
+ content.associated_with(content, type: :association, cardinality: %w(uses used))
67
+ document.attach_note('This is a document', 'green')
71
68
  ```
72
69
 
73
70
  ### Adding notes
74
71
 
75
- You can add notes too the document itself as well as attached to class
72
+ You can add notes to the document itself as well as attached to a class
76
73
 
77
74
  ```ruby
78
75
  YUML.generate(file: 'tmp.pd') do |uml|
@@ -9,21 +9,16 @@ module YUML
9
9
  @relationships = []
10
10
  end
11
11
 
12
- def name(name = nil)
12
+ def name(name = nil, prototype = nil)
13
13
  @name = name if name
14
- "#{normalized_interface}#{@name}"
14
+ @prototype = prototype if prototype
15
+ "#{normalized_prototype}#{@name}"
15
16
  end
16
17
 
17
- def interface(interface = nil, sterotype = 'interface')
18
- @interface = interface if interface
19
- @sterotype = sterotype if interface
20
- @interface
21
- end
22
-
23
- def interface=(*args)
18
+ def name=(*args)
24
19
  args.flatten!
25
- @interface = args.first
26
- @sterotype = args.size > 1 ? args.pop : 'interface'
20
+ @name = args.first
21
+ @prototype = args.pop if args.size > 1
27
22
  end
28
23
 
29
24
  def variables(*args)
@@ -79,9 +74,8 @@ module YUML
79
74
  end
80
75
  end
81
76
 
82
- def normalized_interface
83
- name interface unless @name
84
- return normalize(["<<#{@sterotype}>>"]).first << ';' if interface
77
+ def normalized_prototype
78
+ return normalize(["<<#{@prototype}>>"]).first << ';' if @prototype
85
79
  end
86
80
 
87
81
  def attributes(attrs)
@@ -26,45 +26,32 @@ describe YUML::Class do
26
26
  end
27
27
 
28
28
  describe '#name' do
29
- it 'takes a name and updates the class' do
30
- @uut.name 'Document'
31
- expect(@uut.to_s).to eq '[Document]'
32
- end
33
-
34
- it 'should work with name= as well' do
35
- @uut.name = 'Document'
36
- expect(@uut.to_s).to eq '[Document]'
37
- end
38
- end
39
-
40
- describe '#interface' do
41
29
  before :all do
42
30
  left = "#{YUML::ESCAPE_CHARACTERS['<']}" * 2
43
31
  right = "#{YUML::ESCAPE_CHARACTERS['>']}" * 2
44
- @interface_uml = "[#{left}interface#{right};Document]"
45
32
  @module_uml = "[#{left}module#{right};Document]"
46
33
  end
47
34
 
48
- context 'with default sterotype' do
49
- it 'takes an interface and updates the class' do
50
- @uut.interface 'Document'
51
- expect(@uut.to_s).to eq @interface_uml
35
+ context 'without a prototype' do
36
+ it 'takes a name and updates the class' do
37
+ @uut.name 'Document'
38
+ expect(@uut.to_s).to eq '[Document]'
52
39
  end
53
40
 
54
- it 'should work with interface=' do
55
- @uut.interface = 'Document'
56
- expect(@uut.to_s).to eq @interface_uml
41
+ it 'should work with name= as well' do
42
+ @uut.name = 'Document'
43
+ expect(@uut.to_s).to eq '[Document]'
57
44
  end
58
45
  end
59
46
 
60
- context 'with custom sterotype' do
61
- it 'takes an interface and updates the class' do
62
- @uut.interface 'Document', 'module'
47
+ context 'with a prototype' do
48
+ it 'takes a name and updates the class' do
49
+ @uut.name 'Document', 'module'
63
50
  expect(@uut.to_s).to eq @module_uml
64
51
  end
65
52
 
66
- it 'should work with interface=' do
67
- @uut.interface = 'Document', 'module'
53
+ it 'should work with name= as well' do
54
+ @uut.name = 'Document', 'module'
68
55
  expect(@uut.to_s).to eq @module_uml
69
56
  end
70
57
  end
@@ -121,7 +108,7 @@ describe YUML::Class do
121
108
  end
122
109
 
123
110
  it 'should handle interfaces' do
124
- @pic.interface 'Picture'
111
+ @pic.name 'Picture', 'interface'
125
112
  @doc.is_a(@pic, type: :interface)
126
113
  left = "#{YUML::ESCAPE_CHARACTERS['<']}" * 2
127
114
  right = "#{YUML::ESCAPE_CHARACTERS['>']}" * 2
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.4.1
4
+ version: 0.4.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-28 00:00:00.000000000 Z
11
+ date: 2016-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec