relaton-itu 1.20.0 → 1.20.2

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: 5a30bf20031156fa42620cdc60617bfde448a9ea5404f30839856aa885c16542
4
- data.tar.gz: fa19d27c32808e7856d687bd57a667ca369dffe1bef11b94b55a2be594f98f81
3
+ metadata.gz: 17a791929b754f96d871d876154a933d2c2f318cbe09da51a4a94b4c5d9c8262
4
+ data.tar.gz: 407933d5de7be59b6db6af3b70cd3dc6b82cb0194fc5c457b6dd55fb23467191
5
5
  SHA512:
6
- metadata.gz: ca37959c346cb6386461c933b802949322c8536325078e4b5a5affaf50db81884b68be273f05d96d788f56ad1fca1521e54328a564d834763f49f66e29f49c9f
7
- data.tar.gz: dc698fc47d0cc3fcf91b848bb6e901d255cf16322600f3f047fc752dcf590686bc3c9d7ac0e089251cae7db4a149ec42e1d3e831322c28e2b8f671f5b65999e9
6
+ metadata.gz: d4ecb485408a423a9909be4ef09c6b405a883628c3b16c1aa85447ecf2d0e1e71cadb683f795d0ff261f614b62afe2483661236ff734f67fb804d327a202bc7e
7
+ data.tar.gz: e90a2ef02d06283247baee88ba27284d9cc763785bf24486591c5605e69b7fb99477cbeeb800895e0264c69bdffb21bd73352bedafa6694a3fd79dd1f6943f78
data/Gemfile CHANGED
@@ -13,3 +13,7 @@ gem "ruby-jing"
13
13
  gem "simplecov"
14
14
  gem "vcr"
15
15
  gem "webmock"
16
+
17
+ group :development do
18
+ gem 'pry'
19
+ end
@@ -1,10 +1,9 @@
1
1
  module RelatonItu
2
2
  class DocumentType < RelatonBib::DocumentType
3
3
  TYPES = %w[
4
- recommendation recommendation-supplement recommendation-amendment
5
- recommendation-corrigendum recommendation-errata recommendation-annex
6
- focus-group implementers-guide technical-paper technical-report
7
- joint-itu-iso-iec resolution service-publication handbook question
4
+ recommendation recommendation-supplement recommendation-amendment recommendation-corrigendum
5
+ recommendation-errata recommendation-annex focus-group implementers-guide technical-paper
6
+ technical-report joint-itu-iso-iec resolution service-publication handbook question contribution
8
7
  ].freeze
9
8
 
10
9
  def initialize(type:, abbreviation: nil)
@@ -38,7 +38,9 @@ module RelatonItu
38
38
  rule(:ver) { space >> str("(V") >> num.repeat(1, 2).as(:version) >> str(")") }
39
39
  rule(:ver?) { ver.maybe }
40
40
 
41
- rule(:itu_pubid) { prefix >> sector >> type? >> code >> sup? >> annex? >> ver? >> date? >> amd? >> any.repeat }
41
+ rule(:itu_pubid_sector) { prefix >> sector >> type? >> code >> sup? >> annex? >> ver? >> date? >> amd? >> any.repeat }
42
+ rule(:itu_pubid_no_sector) { prefix >> type? >> code >> sup? >> annex? >> ver? >> date? >> amd? >> any.repeat }
43
+ rule(:itu_pubid) { itu_pubid_sector | itu_pubid_no_sector }
42
44
  root(:itu_pubid)
43
45
  end
44
46
 
@@ -59,9 +61,9 @@ module RelatonItu
59
61
  # @param [String, nil] amd amendment number
60
62
  # @param [String, nil] amd_date amendment
61
63
  #
62
- def initialize(prefix:, sector:, code:, **args)
64
+ def initialize(prefix:, code:, **args)
63
65
  @prefix = prefix
64
- @sector = sector
66
+ @sector = args[:sector]
65
67
  @type = args[:type]
66
68
  @day = args[:day]
67
69
  @code, year, month = date_from_code code
@@ -84,7 +86,8 @@ module RelatonItu
84
86
  end
85
87
 
86
88
  def to_h(with_type: true) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
87
- hash = { prefix: prefix, sector: sector, code: code }
89
+ hash = { prefix: prefix, code: code }
90
+ hash[:sector] = sector if sector
88
91
  hash[:type] = type if type && with_type
89
92
  hash[:suppl] = suppl if suppl
90
93
  hash[:annex] = annex if annex
@@ -102,7 +105,8 @@ module RelatonItu
102
105
  end
103
106
 
104
107
  def to_s(ref: false) # rubocop:disable Metrics/AbcSize
105
- s = "#{prefix}-#{sector}"
108
+ s = prefix.dup
109
+ s << "-#{sector}" if sector
106
110
  s << " #{type}" if type && !ref
107
111
  s << " #{code}"
108
112
  s << " Suppl. #{suppl}" if suppl
@@ -1,3 +1,3 @@
1
1
  module RelatonItu
2
- VERSION = "1.20.0".freeze
2
+ VERSION = "1.20.2".freeze
3
3
  end
@@ -14,8 +14,7 @@ module RelatonItu
14
14
  # @param ext [Nokogiri::XML::Element]
15
15
  # @return [RelatonItu::EditorialGroup]
16
16
  def fetch_editorialgroup(ext)
17
- eg = ext.at("./editorialgroup")
18
- return unless eg
17
+ return unless ext && (eg = ext.at "editorialgroup")
19
18
 
20
19
  EditorialGroup.new(
21
20
  bureau: eg.at("bureau")&.text,
@@ -51,8 +50,7 @@ module RelatonItu
51
50
  # @param ext [Nokogiri::XML::Element]
52
51
  # @return [RelatonItu::StructuredIdentifier]
53
52
  def fetch_structuredidentifier(ext)
54
- sid = ext.at "./structuredidentifier"
55
- return unless sid
53
+ return unless ext && (sid = ext.at "./structuredidentifier")
56
54
 
57
55
  br = sid.at("bureau").text
58
56
  dn = sid.at("docnumber").text
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-itu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.20.0
4
+ version: 1.20.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-13 00:00:00.000000000 Z
11
+ date: 2025-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  requirements: []
132
- rubygems_version: 3.3.27
132
+ rubygems_version: 3.5.22
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: 'RelatonItu: retrieve ITU Standards for bibliographic use using the BibliographicItem