lutaml-uml 0.2.7 → 0.2.8

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: caa272840dbf2e26c09465e9fc43ce87e27264d1304f3e517177e1c2aeb5ddd5
4
- data.tar.gz: 63accfb7dc6651f7df5a2fa16e1f3049efeac98f2b7c45ab33797e5589955011
3
+ metadata.gz: ef28b2562bcae4b385b3be898a71d6c326c59d5167c94ee1231932df060d5eee
4
+ data.tar.gz: 39519359dc16f9532379b5ce15aef7e8ed6d37a1ae5afa2e22253c025505d0ab
5
5
  SHA512:
6
- metadata.gz: 60f0496d0d68e7ec42f96d2dea4e28b2f48be4ff46f079afc0a0041a31e9a0a32d6353f8a208a7194585c4e95a31a7fdaeb5e8bc21e94752b9ce8953d8b4655e
7
- data.tar.gz: f1c58b701b5eff18c42c4fb8a38c9beab572663a345ea048abc112993f671b38e17ff8af9852951cc7650969715130996639bb4cb1eb517ba3cae83a023ee30e
6
+ metadata.gz: 8b2464f9bc2d0f95a3baf5025ca2853537e6abd175a62be6f4f427e7f5f3e13f75f7ec9d2f7c9a675bd17be67b913da3a0b690c806e63a12f0633187471a6ec6
7
+ data.tar.gz: 72a944718bd7c57c8146197f10810b40a4026cf71150f65b0ce7c17158bf046815ce71da1845c8b9d6d720521fa693fb006a50c8e02fac31b44ad8ae2b521fc3
@@ -100,9 +100,9 @@ view_yaml["imports"].keys.each do |entry|
100
100
  if values["definition"]
101
101
  result_string += <<~TEXT
102
102
  {
103
- definition
103
+ definition {
104
104
  #{values['definition']}
105
- end definition
105
+ }
106
106
  }
107
107
  TEXT
108
108
  end
@@ -16,7 +16,6 @@ module Lutaml
16
16
 
17
17
  attr_reader :associations,
18
18
  :attributes,
19
- :definition,
20
19
  :members,
21
20
  :modifier
22
21
 
@@ -32,10 +31,6 @@ module Lutaml
32
31
  @modifier = value.to_s # TODO: Validate?
33
32
  end
34
33
 
35
- def definition=(value)
36
- @definition = value.to_s
37
- end
38
-
39
34
  def attributes=(value)
40
35
  @attributes = value.to_a.map do |attr|
41
36
  TopElementAttribute.new(attr)
@@ -27,10 +27,6 @@ module Lutaml
27
27
  end
28
28
  end
29
29
 
30
- def definition=(value)
31
- @definition = value.to_s
32
- end
33
-
34
30
  # TODO: reserved name, change
35
31
  def methods
36
32
  []
@@ -82,9 +82,9 @@ module Lutaml
82
82
  str(")")).maybe
83
83
  end
84
84
  rule(:cardinality_body_definition) do
85
- match['0-9\*'].as(:min) >>
85
+ match['0-9\*'].as('min') >>
86
86
  str("..").maybe >>
87
- match['0-9\*'].as(:max).maybe
87
+ match['0-9\*'].as('max').maybe
88
88
  end
89
89
  rule(:cardinality) do
90
90
  str("[") >>
@@ -293,9 +293,9 @@ module Lutaml
293
293
  whitespace? >>
294
294
  str("{") >>
295
295
  whitespace? >>
296
- (str("}").absent? >> any).repeat.as(:definition) >>
296
+ (match("[\n\s]}").absent? >> any).repeat.as(:definition) >>
297
297
  whitespace? >>
298
- str("}")
298
+ str('}')
299
299
  end
300
300
 
301
301
  # -- Enum
@@ -6,6 +6,7 @@ module Lutaml
6
6
  include HasAttributes
7
7
 
8
8
  attr_accessor :name,
9
+ :definition,
9
10
  :xmi_id,
10
11
  :xmi_uuid,
11
12
  :namespace,
@@ -42,6 +43,16 @@ module Lutaml
42
43
 
43
44
  the_name
44
45
  end
46
+
47
+ def definition=(value)
48
+ @definition = value
49
+ .to_s
50
+ .gsub(/\\}/, '}')
51
+ .gsub(/\\{/, '{')
52
+ .split("\n")
53
+ .map(&:strip)
54
+ .join("\n")
55
+ end
45
56
  end
46
57
  end
47
58
  end
@@ -21,6 +21,16 @@ module Lutaml
21
21
  update_attributes(attributes)
22
22
  end
23
23
  # rubocop:enable Rails/ActiveRecordAliases
24
+
25
+ def definition=(value)
26
+ @definition = value
27
+ .to_s
28
+ .gsub(/\\}/, '}')
29
+ .gsub(/\\{/, '{')
30
+ .split("\n")
31
+ .map(&:strip)
32
+ .join("\n")
33
+ end
24
34
  end
25
35
  end
26
36
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lutaml
4
4
  module Uml
5
- VERSION = "0.2.7"
5
+ VERSION = "0.2.8"
6
6
  end
7
7
  end
@@ -6,6 +6,7 @@ diagram MyView {
6
6
  this is multiline with `ascidoc`
7
7
  comments
8
8
  and list
9
+ \{foo\} \{name\}
9
10
  }
10
11
  +addressClassProfile: CharacterString [0..1]
11
12
  }
@@ -16,6 +17,7 @@ diagram MyView {
16
17
  {
17
18
  this is attribute definition
18
19
  with multiply lines
20
+ \{foo\} \{name\}
19
21
  end definition
20
22
  }
21
23
  }
@@ -121,7 +121,7 @@ RSpec.describe Lutaml::Uml::Parsers::Dsl do
121
121
  expect(association.member_end).to(eq("AttributeProfile"))
122
122
  expect(association.member_end_attribute_name)
123
123
  .to(eq("attributeProfile"))
124
- expect(association.member_end_cardinality).to(eq(min: "0", max: "*"))
124
+ expect(association.member_end_cardinality).to(eq("min" => "0", "max" => "*"))
125
125
  end
126
126
  end
127
127
 
@@ -254,10 +254,10 @@ RSpec.describe Lutaml::Uml::Parsers::Dsl do
254
254
  File.new(fixtures_path("dsl/diagram_definitions.lutaml"))
255
255
  end
256
256
  let(:class_definition) do
257
- "this is multiline with `ascidoc`\n comments\n and list"
257
+ "this is multiline with `ascidoc`\ncomments\nand list\n{foo} {name}"
258
258
  end
259
259
  let(:attribute_definition) do
260
- "this is attribute definition\n with multiply lines\n end definition"
260
+ "this is attribute definition\nwith multiply lines\n{foo} {name}\nend definition"
261
261
  end
262
262
 
263
263
  it "create comments for document and classes" 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.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-27 00:00:00.000000000 Z
11
+ date: 2020-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie