relaton-iso 2.0.0.pre.alpha.7 → 2.0.0.pre.alpha.8

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: 8e76d7d42d7e6dfbd362753f345eb6fdd66cb10db2cf9453cc1f712d88aefd35
4
- data.tar.gz: f7b82618ba1a3d27bb07329643e2319853a801d439c0e1bda43716eb7b30c399
3
+ metadata.gz: fdfe75f079abbfdcffde6545be1d017bc010479a84cd5e132edf4bdd0aa8a2b4
4
+ data.tar.gz: 2b2a8cb71b2b2ef7adb467ef19c282eda7474d31fcee76bc87d77df15eb35a02
5
5
  SHA512:
6
- metadata.gz: e9339fc84f10f081d9bb498c0d33925e9d648cd2708097150516c33821dd4cd9ec1b28973f1ec3c5803f0faefcbbdb9c6739609a7d97a508406e799021980812
7
- data.tar.gz: 26f1afd730ee2a8272c3ad7ad2e073bbe79ced42fcfdfd96ac92f54b98695ef903a2db8c17a0367311391b603156d71ca4134cfa4169ee732dfc27c27ffd3317
6
+ metadata.gz: 8c686aab9cdcbbc19936f774417a91283cdfa0cde068a0bdded44a845c96dfa65869695afe62aa69d42ff67dd9b272aff5f631b8d68632b0468fa9a54c17b2ed
7
+ data.tar.gz: 30c3eb6d1e1d23a0c4fcda9c427ab9335affe4c5b149567492d0f6ae9dcd9231c1f81498b282baf46c414fd93e234cc9f4a44d8a6d51f78d3fd1ed9a5d3fbf63
@@ -28,7 +28,8 @@ module Relaton
28
28
 
29
29
  # iso-tc identifiers are TC document numbers, not ISO standard
30
30
  # identifiers — parsing them through Pubid adds a spurious
31
- # "ISO" prefix (#178)
31
+ # "ISO" prefix (#178). Bypass Pubid casting for iso-tc content
32
+ # in both direct construction and XML deserialization paths.
32
33
  def initialize(arg = nil, **kwargs)
33
34
  if arg.is_a?(Hash)
34
35
  raw_content = arg["content"] if arg["type"] == "iso-tc"
@@ -40,6 +41,17 @@ module Relaton
40
41
  @content = raw_content if raw_content.is_a?(String)
41
42
  end
42
43
 
44
+ # Capture raw iso-tc content before Pubid casting (#178).
45
+ # The lutaml-model setter is defined via define_method, so we
46
+ # wrap it with alias_method instead of super.
47
+ alias_method :original_content=, :content=
48
+ def content=(value)
49
+ if value.is_a?(String) && type == "iso-tc"
50
+ @iso_tc_raw = value
51
+ end
52
+ send(:original_content=, value)
53
+ end
54
+
43
55
  def content_to_xml(model, parent, doc)
44
56
  doc.add_xml_fragment parent, model.to_s
45
57
  end
@@ -86,6 +98,7 @@ module Relaton
86
98
 
87
99
  def to_s
88
100
  return content if content.is_a? String
101
+ return @iso_tc_raw if @iso_tc_raw
89
102
 
90
103
  case type
91
104
  when "URN" then content.urn
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Relaton
4
4
  module Iso
5
- VERSION = "2.0.0-alpha.7"
5
+ VERSION = "2.0.0-alpha.8"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.alpha.7
4
+ version: 2.0.0.pre.alpha.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.