xmi 0.5.8 → 0.5.9

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
  SHA256:
3
- metadata.gz: f0997666c684b3fda1a34f09670b653eec8a77eaceb4da847f18995defd07e03
4
- data.tar.gz: 638f2e9a2c5d9a50eab010dc317961fda79103cb2e94957290ba0ea7b27b69ef
3
+ metadata.gz: 4098854bb77dff010c940c3a723f127d0d5870e86cfa557a67550f0a40d5148f
4
+ data.tar.gz: b20c8e1371670c8df054995a1666eb11cd9c68b71b68f5c7c2d4ad5dd0081746
5
5
  SHA512:
6
- metadata.gz: 1024c147bb0feb0ee1439694d0fde8e63db3473ecd0629e2fd3cdb990c7b5f07222bdae39c7ff5afaca2cf1172ba8a0a454c148d85e9ea2ed653207c3e62a1aa
7
- data.tar.gz: 869a20f40d3c34cf40f53aa2508dcd0a44da289c04e4d3db7290cd0b353b9de7e65d5284af77f80e45f6b33a60d982ad23f67c12e411dea4d9ee9bef28f1e745
6
+ metadata.gz: af603dcdf25510f8dade18d329986181ad651de7d5b1eceaedbf6842758bc7e1d4beb635b5973bf38c5e2f7f9d201ceafeb96c5957a1ef10f7eb4262cc9cb288
7
+ data.tar.gz: c0c239408d41612dec465659dbf32cbf94aa9b2bf7d2a002a506e0c5b7fb9e2201b104acf5c2bc5bf9accb7f84a45191a397e22e8dc7e2adcf6c485916448908
@@ -49,6 +49,7 @@ module Xmi
49
49
  )
50
50
 
51
51
  klass = Class.new(Lutaml::Model::Serializable)
52
+ klass.define_singleton_method(:root_tag) { nil }
52
53
 
53
54
  # Add tag attributes (NO xml mapping for abstract classes)
54
55
  tags = abstract_node.search("Tag")
@@ -24,7 +24,7 @@ module Xmi
24
24
  map_entries = []
25
25
  new_klasses.each do |klass_name|
26
26
  klass = EaRoot.const_get(module_name).const_get(klass_name)
27
- next unless klass.respond_to?(:root_tag)
27
+ next unless klass.root_tag
28
28
 
29
29
  method_name = Lutaml::Model::Utils.snake_case(klass_name)
30
30
  map_entries << [klass.root_tag, method_name.to_sym]
@@ -17,7 +17,7 @@ module Xmi
17
17
  module FixEncoding
18
18
  def self.call(ctx)
19
19
  xml = ctx[:xml]
20
- if xml.respond_to?(:valid_encoding?) && !xml.valid_encoding?
20
+ unless xml.valid_encoding?
21
21
  ctx[:xml] = xml
22
22
  .encode("UTF-16be", invalid: :replace, replace: "?")
23
23
  .encode("UTF-8")
@@ -45,7 +45,7 @@ module Xmi
45
45
 
46
46
  module BuildIndex
47
47
  def self.call(ctx)
48
- ctx[:root].build_index if ctx[:root].respond_to?(:build_index)
48
+ ctx[:root].build_index
49
49
  ctx
50
50
  end
51
51
  end
data/lib/xmi/parsing.rb CHANGED
@@ -27,7 +27,7 @@ module Xmi
27
27
  # @option options [Boolean] :strict Raise on unknown elements
28
28
  # @return [Root, Object] Parsed XMI document
29
29
  def parse(xml, options = {})
30
- xml_content = xml.respond_to?(:read) ? xml.read : xml.to_s
30
+ xml_content = xml.is_a?(String) ? xml : xml.read
31
31
 
32
32
  Xmi.init_versioning! unless Xmi.versioning_initialized?
33
33
 
data/lib/xmi/root.rb CHANGED
@@ -24,6 +24,10 @@ module Xmi
24
24
 
25
25
  attribute :model, Uml::UmlModel
26
26
 
27
+ def build_index
28
+ nil
29
+ end
30
+
27
31
  xml do
28
32
  root "XMI"
29
33
  namespace ::Xmi::Namespace::Omg::Xmi
@@ -116,7 +116,7 @@ module Xmi
116
116
  def build(root)
117
117
  model = root.model
118
118
  if model
119
- id = model.id if model.respond_to?(:id)
119
+ id = model.id
120
120
  @id_name_map[id] = model.name if id && model.name
121
121
  walk_packaged_elements(model.packaged_element, nil)
122
122
  end
@@ -247,10 +247,7 @@ module Xmi
247
247
  return unless profile_list
248
248
 
249
249
  profile_list.each do |profile|
250
- if profile.respond_to?(:packaged_element)
251
- walk_packaged_elements(profile.packaged_element,
252
- nil)
253
- end
250
+ walk_packaged_elements(profile.packaged_element, nil)
254
251
  end
255
252
  end
256
253
  end
@@ -3,6 +3,7 @@
3
3
  module Xmi
4
4
  module Uml
5
5
  class UmlModel < Lutaml::Model::Serializable
6
+ attribute :id, ::Xmi::Type::XmiId
6
7
  attribute :type, ::Xmi::Type::XmiType
7
8
  attribute :name, :string
8
9
  attribute :profile_application, ProfileApplication, collection: true
@@ -14,6 +15,7 @@ module Xmi
14
15
  root "Model"
15
16
  namespace ::Xmi::Namespace::Omg::Uml
16
17
 
18
+ map_attribute "id", to: :id
17
19
  map_attribute "type", to: :type
18
20
  map_attribute "name", to: :name
19
21
 
data/lib/xmi/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Xmi
4
- VERSION = "0.5.8"
4
+ VERSION = "0.5.9"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xmi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.