relaton-iso-bib 1.19.2 → 1.20.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: 860f3d81266f83e7f0a1d83d9f2e6a46ace0756beb111b220cf594396d0dc279
4
- data.tar.gz: 7d0370c90d4b736d2639c50ac4911de82979ee1030e8ae195ea365af6d85d372
3
+ metadata.gz: c67887a51ee3fb592c44c0b17b5a7bd719649f0d6e0bbeaa7d4f78856c9b0470
4
+ data.tar.gz: 983766d082992e9b953cf6feee7a8e5dc51c14611394d5835d1f9f5ff7b43d68
5
5
  SHA512:
6
- metadata.gz: bd2746def404ebe7c6f9048567f1f27a48ddb133f4e02b3092a7e5fec809ebc9c1e006c7a6a1a49df5820dde94faf72d334356932d1e948bc38bc514860adafd
7
- data.tar.gz: 49d5bfe5dd54eee4cb279cd3a200b3efa4efefb7b77a6c8198dd2802f6e2507478f82c95c82911db439830cb25a458edd6b7b8810116ea54b369ffee114888ac
6
+ metadata.gz: 13668716fca704f98eb6e4763b920e2aaf92ffea6e098384ce6e55369ab6d5f0936b73869b9ea0b624fc010df3a4739c0cafeb666ad14e09eaf0a5dc85b36305
7
+ data.tar.gz: fcd8fd493a61ed2220f538b5174517d0d701d7ca35f782818e1135de1e1b3d8362e18d7e9673a2221109049b2191f91ab3e3a4ae13cf666e7655a117b90738dd
@@ -5,6 +5,15 @@ module RelatonIsoBib
5
5
 
6
6
  private
7
7
 
8
+ def ext_has_to_bib(ret)
9
+ super
10
+ ret[:stagename] = ret[:ext][:stagename] if ret.dig(:ext, :stagename)
11
+ ret[:horizontal] = ret[:ext][:horizontal] unless ret.dig(:ext, :horizontal).nil?
12
+ ret[:fast_track] = ret[:ext][:fast_track] unless ret.dig(:ext, :fast_track).nil?
13
+ ret[:price_code] = ret[:ext][:price_code] if ret.dig(:ext, :price_code)
14
+ ret
15
+ end
16
+
8
17
  #
9
18
  # Ovverides superclass's method
10
19
  #
@@ -25,7 +34,7 @@ module RelatonIsoBib
25
34
 
26
35
  # @param ret [Hash]
27
36
  def editorialgroup_hash_to_bib(ret)
28
- eg = ret[:editorialgroup]
37
+ eg = ret.dig(:ext, :editorialgroup) || ret[:editorialgroup] # TODO: remove :editorialgroup after all bibdata are updated
29
38
  return unless eg
30
39
 
31
40
  ret[:editorialgroup] = EditorialGroup.new(
@@ -38,16 +47,18 @@ module RelatonIsoBib
38
47
 
39
48
  # @param ret [Hash]
40
49
  def ics_hash_to_bib(ret)
41
- ret[:ics] = RelatonBib.array(ret[:ics]).map do |ics|
42
- Ics.new(ics[:code] || ics)
43
- end
50
+ ics = ret.dig(:ext, :ics) || ret[:ics] # TODO: remove :ics after all bibdata are updated
51
+ return unless ics
52
+
53
+ ret[:ics] = RelatonBib.array(ics).map { |item| Ics.new(item[:code] || item) }
44
54
  end
45
55
 
46
56
  # @param ret [Hash]
47
57
  def structuredidentifier_hash_to_bib(ret)
48
- return unless ret[:structuredidentifier]
58
+ struct_id = ret.dig(:ext, :structuredidentifier) || ret[:structuredidentifier] # TODO: remove :structuredidentifier after all bibdata are updated
59
+ return unless struct_id
49
60
 
50
- ret[:structuredidentifier] = RelatonIsoBib::StructuredIdentifier.new(**ret[:structuredidentifier])
61
+ ret[:structuredidentifier] = RelatonIsoBib::StructuredIdentifier.new(**struct_id)
51
62
  end
52
63
 
53
64
  def create_doctype(**args)
@@ -162,7 +162,7 @@ module RelatonIsoBib
162
162
  def to_xml(**opts)
163
163
  super(**opts) do |b|
164
164
  if block_given? then yield b
165
- elsif opts[:bibdata] && has_ext_attrs?
165
+ elsif opts[:bibdata] && has_ext?
166
166
  ext = b.ext do
167
167
  doctype.to_xml b if doctype
168
168
  b.subdoctype subdoctype if subdoctype
@@ -191,13 +191,17 @@ module RelatonIsoBib
191
191
  #
192
192
  def to_hash(embedded: false)
193
193
  hash = super
194
- hash["horizontal"] = horizontal unless horizontal.nil?
195
- hash["stagename"] = stagename if stagename
196
- hash["fast_track"] = fast_track unless fast_track.nil?
197
- hash["price_code"] = price_code if price_code
194
+ hash["ext"]["horizontal"] = horizontal unless horizontal.nil?
195
+ hash["ext"]["stagename"] = stagename if stagename
196
+ hash["ext"]["fast_track"] = fast_track unless fast_track.nil?
197
+ hash["ext"]["price_code"] = price_code if price_code
198
198
  hash
199
199
  end
200
200
 
201
+ def has_ext?
202
+ super || horizontal || stagename || fast_track || price_code
203
+ end
204
+
201
205
  # @param prefix [String]
202
206
  # @return [String]
203
207
  def to_asciibib(prefix = "")
@@ -226,9 +230,8 @@ module RelatonIsoBib
226
230
  #
227
231
  # @return [Boolean]
228
232
  #
229
- def has_ext_attrs? # rubocop:disable Metrics/CyclomaticComplexity
230
- (doctype || !horizontal.nil? || editorialgroup || ics.any? ||
231
- structuredidentifier || stagename || horizontal)
233
+ def has_ext? # rubocop:disable Metrics/CyclomaticComplexity
234
+ super || !horizontal.nil? || ics&.any? || stagename || !fast_track.nil? || price_code
232
235
  end
233
236
  end
234
237
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonIsoBib
2
- VERSION = "1.19.2".freeze
2
+ VERSION = "1.20.0".freeze
3
3
  end
@@ -27,5 +27,5 @@ Gem::Specification.new do |spec|
27
27
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
28
28
 
29
29
  spec.add_dependency "isoics", "~> 0.1.6"
30
- spec.add_dependency "relaton-bib", "~> 1.19.0"
30
+ spec.add_dependency "relaton-bib", "~> 1.20.0"
31
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iso-bib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.2
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-31 00:00:00.000000000 Z
11
+ date: 2024-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: isoics
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.19.0
33
+ version: 1.20.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.19.0
40
+ version: 1.20.0
41
41
  description: 'RelatonIsoBib: Ruby ISOXMLDOC impementation.'
42
42
  email:
43
43
  - open.source@ribose.com
@@ -78,7 +78,7 @@ homepage: https://github.com/relaton/relaton-iso-bib
78
78
  licenses:
79
79
  - BSD-2-Clause
80
80
  metadata: {}
81
- post_install_message:
81
+ post_install_message:
82
82
  rdoc_options: []
83
83
  require_paths:
84
84
  - lib
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  requirements: []
96
96
  rubygems_version: 3.3.27
97
- signing_key:
97
+ signing_key:
98
98
  specification_version: 4
99
99
  summary: 'RelatonIsoBib: Ruby ISOXMLDOC impementation.'
100
100
  test_files: []