lutaml-uml 0.2.12 → 0.3.0

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
  SHA256:
3
- metadata.gz: 405ff7c4bd2b9ebdde4a00c00c0c5e21188f0632206a64379a3e294fcad91cf0
4
- data.tar.gz: 4f4ce9d31b300185e52ddf44375bc5a6597fc16c72e047963a283ab618205b83
3
+ metadata.gz: 3436e32ef66aba3d38cf8418de2ecef7bd475a1379e62e787aaddb0701397b55
4
+ data.tar.gz: da160c6b5ffaa013cb0d4bc4df8a23175acdff14da402c15b883c96a424cbd83
5
5
  SHA512:
6
- metadata.gz: 738287fadf7e75d576dc85bb3dce7f1781b3307770b8ad05b994101d421c73bc81450d49af5cd88e10b7466924591c504590ffbfdf405bf4f2ca1bec6d12ddfa
7
- data.tar.gz: a7b87af376643a4db9c7d700ef3fae74d45c4a70ecf09e85667640cca55c4083afde0eba1ce2f7a4e18d7b1a3351ce3f89574aa2917b543413677836928f941a
6
+ metadata.gz: f76a00663fa9a4a8167930d4114ef4995ce7b488034336dd1134953ca9ed09ab4fd2da6e32a425082b6cf212b97bf47493e0b3f45c4b181fa93966f581ad7265
7
+ data.tar.gz: 85f1fd71d5df7d0e673a5c4994f7d524dbaa915afca26bdacd483e384889003114e3f91ac1d7c0a28bc9a649b675036458c4fcc685b9e8534b6a49c346bb269d
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "lutaml/uml/class"
4
- require "lutaml/uml/enum"
5
4
  require "lutaml/uml/data_type"
5
+ require "lutaml/uml/enum"
6
+ require "lutaml/uml/package"
6
7
  require "lutaml/uml/primitive_type"
7
8
 
8
9
  module Lutaml
@@ -18,23 +19,27 @@ module Lutaml
18
19
  :fidelity,
19
20
  :fontname,
20
21
  :comments
22
+ attr_reader :packages
21
23
 
22
24
  # rubocop:disable Rails/ActiveRecordAliases
23
25
  def initialize(attributes = {})
24
26
  update_attributes(attributes)
25
27
  end
26
28
  # rubocop:enable Rails/ActiveRecordAliases
27
-
28
29
  def classes=(value)
29
30
  @classes = value.to_a.map { |attributes| Class.new(attributes) }
30
31
  end
31
32
 
33
+ def data_types=(value)
34
+ @data_types = value.to_a.map { |attributes| DataType.new(attributes) }
35
+ end
36
+
32
37
  def enums=(value)
33
38
  @enums = value.to_a.map { |attributes| Enum.new(attributes) }
34
39
  end
35
40
 
36
- def data_types=(value)
37
- @data_types = value.to_a.map { |attributes| DataType.new(attributes) }
41
+ def packages=(value)
42
+ @packages = value.to_a.map { |attributes| Package.new(attributes) }
38
43
  end
39
44
 
40
45
  def primitives=(value)
@@ -59,6 +64,10 @@ module Lutaml
59
64
  @data_types || []
60
65
  end
61
66
 
67
+ def packages
68
+ @packages || []
69
+ end
70
+
62
71
  def primitives
63
72
  @primitives || []
64
73
  end
@@ -3,16 +3,37 @@
3
3
  module Lutaml
4
4
  module Uml
5
5
  class Package < TopElement
6
+ include HasAttributes
7
+
6
8
  attr_accessor :imports, :contents
9
+ attr_reader :classes, :enums
10
+
11
+ def initialize(attributes)
12
+ update_attributes(attributes)
13
+ end
14
+
15
+ def classes=(value)
16
+ @classes = value.to_a.map { |attributes| Class.new(attributes) }
17
+ end
18
+
19
+ def enums=(value)
20
+ @enums = value.to_a.map { |attributes| Enum.new(attributes) }
21
+ end
22
+
23
+ def packages=(value)
24
+ @packages = value.to_a.map { |attributes| Package.new(attributes) }
25
+ end
26
+
27
+ def classes
28
+ @classes || []
29
+ end
30
+
31
+ def enums
32
+ @enums || []
33
+ end
7
34
 
8
- def initialize
9
- @imports = []
10
- @contents = []
11
- @name = nil
12
- @xmi_id = nil
13
- @xmi_uuid = nil
14
- @namespace = nil
15
- @href = nil
35
+ def packages
36
+ @packages || []
16
37
  end
17
38
  end
18
39
  end
@@ -117,7 +117,7 @@ module Lutaml
117
117
  attribute_keyword? >>
118
118
  spaces? >>
119
119
  match['"\''].maybe >>
120
- match['a-zA-Z0-9_\- \/'].repeat(1).as(:type) >>
120
+ match['a-zA-Z0-9_\- \/\+'].repeat(1).as(:type) >>
121
121
  match['"\''].maybe >>
122
122
  spaces?
123
123
  )
@@ -126,7 +126,7 @@ module Lutaml
126
126
  attribute_type.maybe
127
127
  end
128
128
 
129
- rule(:attribute_name) { match['a-zA-Z0-9_\- \/'].repeat(1).as(:name) }
129
+ rule(:attribute_name) { match['a-zA-Z0-9_\- \/\+'].repeat(1).as(:name) }
130
130
  rule(:attribute_definition) do
131
131
  (visibility?.as(:visibility) >>
132
132
  match['"\''].maybe >>
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Uml
5
- VERSION = "0.2.12"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
@@ -17,5 +17,9 @@ diagram MyView {
17
17
  #protectedAttributeProfile: CharacterString
18
18
  type/text: String
19
19
  slashType: slash/type
20
+ application/docbook+xml
21
+ application/tei+xml
22
+ text/x-asciidoc
23
+ application/x-isodoc+xml
20
24
  }
21
25
  }
@@ -68,7 +68,7 @@ RSpec.describe Lutaml::Uml::Parsers::Dsl do
68
68
  expect(by_name(classes, "AddressClassProfile")
69
69
  .attributes.length).to eq(1)
70
70
  expect(by_name(classes, "AttributeProfile")
71
- .attributes.length).to eq(9)
71
+ .attributes.length).to eq(13)
72
72
  expect(by_name(classes, "AttributeProfile")
73
73
  .attributes.map(&:name))
74
74
  .to(eq(["imlicistAttributeProfile",
@@ -79,7 +79,11 @@ RSpec.describe Lutaml::Uml::Parsers::Dsl do
79
79
  "friendlyAttributeProfile1",
80
80
  "protectedAttributeProfile",
81
81
  "type/text",
82
- "slashType"]))
82
+ "slashType",
83
+ "application/docbook+xml",
84
+ "application/tei+xml",
85
+ "text/x-asciidoc",
86
+ "application/x-isodoc+xml"]))
83
87
  end
84
88
 
85
89
  it "creates the correct attributes with the correct visibility" do
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.2.12
4
+ version: 0.3.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-03-25 00:00:00.000000000 Z
11
+ date: 2021-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie