lutaml-uml 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lutaml/uml/class.rb +21 -3
- data/lib/lutaml/uml/data_type.rb +63 -2
- data/lib/lutaml/uml/diagram.rb +8 -0
- data/lib/lutaml/uml/document.rb +1 -0
- data/lib/lutaml/uml/enum.rb +10 -1
- data/lib/lutaml/uml/operation.rb +31 -0
- data/lib/lutaml/uml/package.rb +14 -1
- data/lib/lutaml/uml/value.rb +30 -0
- data/lib/lutaml/uml/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57797f5d5a65a5bb7e781509a44460e16877d85c9becb6b6147d43a6180a931c
|
4
|
+
data.tar.gz: caa53fbea010657d6dd53db86460ba5dd4a991076ab078bf08a72f553e5c40da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ec63f9b0992f1ebab8b2c3116e49514cd5753fe4d1e327a40465c001711e0c0bf86410eba964c6aea1514e8bba91297f19d8a615e9e352d296386ab348bd6fa
|
7
|
+
data.tar.gz: 3971b17f96585427e99b3e4000824e99560ed096bea8489dbb62dd7dcba44eca3acd5a5a6ebc55b224aafffae9a963c866f3ca12a365bdc8dd0c54985c93f52e
|
data/lib/lutaml/uml/class.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "lutaml/uml/has_members"
|
4
3
|
require "lutaml/uml/classifier"
|
4
|
+
|
5
|
+
require "lutaml/uml/has_members"
|
5
6
|
require "lutaml/uml/association"
|
6
7
|
require "lutaml/uml/constraint"
|
8
|
+
require "lutaml/uml/data_type"
|
9
|
+
require "lutaml/uml/operation"
|
7
10
|
require "lutaml/uml/top_element_attribute"
|
8
11
|
|
9
12
|
module Lutaml
|
@@ -13,13 +16,16 @@ module Lutaml
|
|
13
16
|
|
14
17
|
attr_accessor :nested_classifier,
|
15
18
|
:is_abstract,
|
16
|
-
:type
|
19
|
+
:type,
|
20
|
+
:package
|
17
21
|
|
18
22
|
attr_reader :associations,
|
19
23
|
:attributes,
|
20
24
|
:members,
|
21
25
|
:modifier,
|
22
|
-
:constraints
|
26
|
+
:constraints,
|
27
|
+
:operations,
|
28
|
+
:data_types
|
23
29
|
|
24
30
|
def initialize(attributes = {})
|
25
31
|
@nested_classifier = []
|
@@ -51,6 +57,18 @@ module Lutaml
|
|
51
57
|
end
|
52
58
|
end
|
53
59
|
|
60
|
+
def operations=(value)
|
61
|
+
@operations = value.to_a.map do |attr|
|
62
|
+
Operation.new(attr)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def data_types=(value)
|
67
|
+
@data_types = value.to_a.map do |attr|
|
68
|
+
DataType.new(attr)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
54
72
|
def methods
|
55
73
|
# @members&.select { |member| member.class == Method }
|
56
74
|
[]
|
data/lib/lutaml/uml/data_type.rb
CHANGED
@@ -1,14 +1,75 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require "lutaml/uml/classifier"
|
2
3
|
|
3
4
|
module Lutaml
|
4
5
|
module Uml
|
5
|
-
class DataType <
|
6
|
-
|
6
|
+
class DataType < Classifier
|
7
|
+
include HasMembers
|
8
|
+
|
9
|
+
attr_accessor :nested_classifier,
|
10
|
+
:is_abstract,
|
11
|
+
:type
|
12
|
+
|
13
|
+
attr_reader :associations,
|
14
|
+
:attributes,
|
15
|
+
:members,
|
16
|
+
:modifier,
|
17
|
+
:constraints,
|
18
|
+
:operations,
|
19
|
+
:data_types
|
7
20
|
|
8
21
|
def initialize(attributes = {})
|
22
|
+
@nested_classifier = []
|
23
|
+
@stereotype = []
|
24
|
+
@generalization = []
|
25
|
+
@is_abstract = false
|
9
26
|
super
|
10
27
|
@keyword = "dataType"
|
11
28
|
end
|
29
|
+
|
30
|
+
def modifier=(value)
|
31
|
+
@modifier = value.to_s # TODO: Validate?
|
32
|
+
end
|
33
|
+
|
34
|
+
def attributes=(value)
|
35
|
+
@attributes = value.to_a.map do |attr|
|
36
|
+
TopElementAttribute.new(attr)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def associations=(value)
|
41
|
+
@associations = value.to_a.map do |attr|
|
42
|
+
Association.new(attr.to_h.merge(owner_end: name))
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def constraints=(value)
|
47
|
+
@constraints = value.to_a.map do |attr|
|
48
|
+
Constraint.new(attr)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def operations=(value)
|
53
|
+
@operations = value.to_a.map do |attr|
|
54
|
+
Operation.new(attr)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def data_types=(value)
|
59
|
+
@data_types = value.to_a.map do |attr|
|
60
|
+
DataType.new(attr)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def methods
|
65
|
+
# @members&.select { |member| member.class == Method }
|
66
|
+
[]
|
67
|
+
end
|
68
|
+
|
69
|
+
def relationships
|
70
|
+
# @members&.select { |member| member.class == ClassRelationship }
|
71
|
+
[]
|
72
|
+
end
|
12
73
|
end
|
13
74
|
end
|
14
75
|
end
|
data/lib/lutaml/uml/document.rb
CHANGED
data/lib/lutaml/uml/enum.rb
CHANGED
@@ -4,6 +4,7 @@ require "lutaml/uml/has_members"
|
|
4
4
|
require "lutaml/uml/classifier"
|
5
5
|
require "lutaml/uml/association"
|
6
6
|
require "lutaml/uml/top_element_attribute"
|
7
|
+
require "lutaml/uml/value"
|
7
8
|
|
8
9
|
module Lutaml
|
9
10
|
module Uml
|
@@ -14,19 +15,27 @@ module Lutaml
|
|
14
15
|
:members,
|
15
16
|
:modifier,
|
16
17
|
:definition,
|
17
|
-
:keyword
|
18
|
+
:keyword,
|
19
|
+
:values
|
18
20
|
|
19
21
|
def initialize(attributes = {})
|
20
22
|
super
|
21
23
|
@keyword = "enumeration"
|
22
24
|
end
|
23
25
|
|
26
|
+
# TODO: delete?
|
24
27
|
def attributes=(value)
|
25
28
|
@attributes = value.to_a.map do |attr|
|
26
29
|
TopElementAttribute.new(attr)
|
27
30
|
end
|
28
31
|
end
|
29
32
|
|
33
|
+
def values=(value)
|
34
|
+
@values = value.to_a.map do |attr|
|
35
|
+
Value.new(attr)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
30
39
|
# TODO: reserved name, change
|
31
40
|
def methods
|
32
41
|
[]
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Uml
|
5
|
+
class Operation
|
6
|
+
include HasAttributes
|
7
|
+
include HasMembers
|
8
|
+
|
9
|
+
attr_accessor :definition,
|
10
|
+
:name,
|
11
|
+
:return_type,
|
12
|
+
:parameter_type
|
13
|
+
|
14
|
+
# rubocop:disable Rails/ActiveRecordAliases
|
15
|
+
def initialize(attributes = {})
|
16
|
+
update_attributes(attributes)
|
17
|
+
end
|
18
|
+
# rubocop:enable Rails/ActiveRecordAliases
|
19
|
+
|
20
|
+
def definition=(value)
|
21
|
+
@definition = value
|
22
|
+
.to_s
|
23
|
+
.gsub(/\\}/, '}')
|
24
|
+
.gsub(/\\{/, '{')
|
25
|
+
.split("\n")
|
26
|
+
.map(&:strip)
|
27
|
+
.join("\n")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/lutaml/uml/package.rb
CHANGED
@@ -6,10 +6,11 @@ module Lutaml
|
|
6
6
|
include HasAttributes
|
7
7
|
|
8
8
|
attr_accessor :imports, :contents
|
9
|
-
attr_reader :classes, :enums
|
9
|
+
attr_reader :classes, :enums, :data_types, :children_packages
|
10
10
|
|
11
11
|
def initialize(attributes)
|
12
12
|
update_attributes(attributes)
|
13
|
+
@children_packages ||= packages.map { |pkg| [pkg, pkg.packages.map(&:children_packages)] }.flatten
|
13
14
|
end
|
14
15
|
|
15
16
|
def classes=(value)
|
@@ -20,10 +21,18 @@ module Lutaml
|
|
20
21
|
@enums = value.to_a.map { |attributes| Enum.new(attributes) }
|
21
22
|
end
|
22
23
|
|
24
|
+
def data_types=(value)
|
25
|
+
@data_types = value.to_a.map { |attributes| DataType.new(attributes) }
|
26
|
+
end
|
27
|
+
|
23
28
|
def packages=(value)
|
24
29
|
@packages = value.to_a.map { |attributes| Package.new(attributes) }
|
25
30
|
end
|
26
31
|
|
32
|
+
def diagrams=(value)
|
33
|
+
@diagrams = value.to_a.map { |attributes| Diagram.new(attributes) }
|
34
|
+
end
|
35
|
+
|
27
36
|
def classes
|
28
37
|
@classes || []
|
29
38
|
end
|
@@ -35,6 +44,10 @@ module Lutaml
|
|
35
44
|
def packages
|
36
45
|
@packages || []
|
37
46
|
end
|
47
|
+
|
48
|
+
def diagrams
|
49
|
+
@diagrams || []
|
50
|
+
end
|
38
51
|
end
|
39
52
|
end
|
40
53
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Uml
|
5
|
+
class Value
|
6
|
+
include HasAttributes
|
7
|
+
include HasMembers
|
8
|
+
|
9
|
+
attr_accessor :definition,
|
10
|
+
:name,
|
11
|
+
:type
|
12
|
+
|
13
|
+
# rubocop:disable Rails/ActiveRecordAliases
|
14
|
+
def initialize(attributes = {})
|
15
|
+
update_attributes(attributes)
|
16
|
+
end
|
17
|
+
# rubocop:enable Rails/ActiveRecordAliases
|
18
|
+
|
19
|
+
def definition=(value)
|
20
|
+
@definition = value
|
21
|
+
.to_s
|
22
|
+
.gsub(/\\}/, '}')
|
23
|
+
.gsub(/\\{/, '{')
|
24
|
+
.split("\n")
|
25
|
+
.map(&:strip)
|
26
|
+
.join("\n")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/lutaml/uml/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lutaml-uml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
@@ -206,6 +206,7 @@ files:
|
|
206
206
|
- lib/lutaml/uml/constructor_end.rb
|
207
207
|
- lib/lutaml/uml/data_type.rb
|
208
208
|
- lib/lutaml/uml/dependency.rb
|
209
|
+
- lib/lutaml/uml/diagram.rb
|
209
210
|
- lib/lutaml/uml/document.rb
|
210
211
|
- lib/lutaml/uml/enum.rb
|
211
212
|
- lib/lutaml/uml/event.rb
|
@@ -228,6 +229,7 @@ files:
|
|
228
229
|
- lib/lutaml/uml/node/method_argument.rb
|
229
230
|
- lib/lutaml/uml/node/relationship.rb
|
230
231
|
- lib/lutaml/uml/opaque_behavior.rb
|
232
|
+
- lib/lutaml/uml/operation.rb
|
231
233
|
- lib/lutaml/uml/package.rb
|
232
234
|
- lib/lutaml/uml/parsers/attribute.rb
|
233
235
|
- lib/lutaml/uml/parsers/dsl.rb
|
@@ -251,6 +253,7 @@ files:
|
|
251
253
|
- lib/lutaml/uml/top_element_attribute.rb
|
252
254
|
- lib/lutaml/uml/transition.rb
|
253
255
|
- lib/lutaml/uml/trigger.rb
|
256
|
+
- lib/lutaml/uml/value.rb
|
254
257
|
- lib/lutaml/uml/version.rb
|
255
258
|
- lib/lutaml/uml/vertex.rb
|
256
259
|
- lutaml-uml.gemspec
|