pubid-core 1.8.2 → 1.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pubid/core/identifier/base.rb +41 -41
- data/lib/pubid/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fc62e629fdd3da242cf3e2f03c0e59d74ba3ad2305df1ab3156abefc4d907a2
|
4
|
+
data.tar.gz: 6eed583e02b27ef472714224c4531a90278bf1f18ac9ded069b2a7c62f09dc36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbf792e4dabc21d7cd2524e82e2976d8833854a9379dc9c526f14d6087639117b0585c8c96aeff5abbf87453ebf8327218bc05658278479b169966a9ab84214c
|
7
|
+
data.tar.gz: b823f8be116ec916600c493f5a4b4c72d7c12f5c7e547ec05a1e87ca840f30f2496a47ec021f77c3b1ee5ab65186b20fe3355687882659c9e03ff9683068a741
|
@@ -74,47 +74,6 @@ module Pubid::Core
|
|
74
74
|
self.class.get_renderer_class.new(get_params).render
|
75
75
|
end
|
76
76
|
|
77
|
-
# @param typed_stage [String, Symbol] eg. "DTR" or :dtr
|
78
|
-
# @return [[Symbol, Stage]] typed stage and stage with assigned harmonized codes
|
79
|
-
def find_typed_stage(typed_stage)
|
80
|
-
if typed_stage.is_a?(Symbol)
|
81
|
-
return [typed_stage,
|
82
|
-
Identifier.build_stage(
|
83
|
-
harmonized_code: Identifier.build_harmonized_stage_code(self.class::TYPED_STAGES[typed_stage][:harmonized_stages])),
|
84
|
-
]
|
85
|
-
end
|
86
|
-
|
87
|
-
typed_stage = self.class::TYPED_STAGES.find do |_, v|
|
88
|
-
if v[:abbr].is_a?(Hash)
|
89
|
-
v[:abbr].value?(typed_stage)
|
90
|
-
else
|
91
|
-
if v.key?(:legacy_abbr)
|
92
|
-
v[:legacy_abbr].include?(typed_stage) || v[:abbr] == typed_stage
|
93
|
-
else
|
94
|
-
v[:abbr] == typed_stage
|
95
|
-
end
|
96
|
-
#
|
97
|
-
# v[:abbr] == typed_stage
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
[typed_stage.first,
|
102
|
-
Identifier.build_stage(
|
103
|
-
harmonized_code: Identifier.build_harmonized_stage_code(typed_stage[1][:harmonized_stages]))]
|
104
|
-
end
|
105
|
-
|
106
|
-
# Resolve typed stage using stage harmonized stage code
|
107
|
-
# @param harmonized_code [HarmonizedStageCode]
|
108
|
-
# @return [Symbol, nil] typed stage or nil
|
109
|
-
def resolve_typed_stage(harmonized_code)
|
110
|
-
self.class::TYPED_STAGES.each do |k, v|
|
111
|
-
if (v[:harmonized_stages] & harmonized_code.stages) == harmonized_code.stages
|
112
|
-
return k
|
113
|
-
end
|
114
|
-
end
|
115
|
-
nil
|
116
|
-
end
|
117
|
-
|
118
77
|
class << self
|
119
78
|
# Parses given identifier
|
120
79
|
# @param code_or_params [String, Hash] code or hash from parser
|
@@ -185,6 +144,10 @@ module Pubid::Core
|
|
185
144
|
nil
|
186
145
|
end
|
187
146
|
|
147
|
+
def get_identifier
|
148
|
+
Identifier
|
149
|
+
end
|
150
|
+
|
188
151
|
def update_old_code(code)
|
189
152
|
return code unless get_update_codes
|
190
153
|
|
@@ -216,6 +179,43 @@ module Pubid::Core
|
|
216
179
|
def type_match?(parameters)
|
217
180
|
parameters[:type] ? has_type?(parameters[:type]) : has_typed_stage?(parameters[:stage])
|
218
181
|
end
|
182
|
+
|
183
|
+
# @param typed_stage [String, Symbol] eg. "DTR" or :dtr
|
184
|
+
# @return [[Symbol, Stage]] typed stage and stage with assigned harmonized codes
|
185
|
+
def find_typed_stage(typed_stage)
|
186
|
+
if typed_stage.is_a?(Symbol)
|
187
|
+
return [typed_stage,
|
188
|
+
get_identifier.build_stage(
|
189
|
+
harmonized_code: get_identifier.build_harmonized_stage_code(self::TYPED_STAGES[typed_stage][:harmonized_stages])),
|
190
|
+
]
|
191
|
+
end
|
192
|
+
|
193
|
+
typed_stage = self::TYPED_STAGES.find do |_, v|
|
194
|
+
if v[:abbr].is_a?(Hash)
|
195
|
+
v[:abbr].value?(typed_stage)
|
196
|
+
elsif v.key?(:legacy_abbr)
|
197
|
+
v[:legacy_abbr].include?(typed_stage) || v[:abbr] == typed_stage
|
198
|
+
else
|
199
|
+
v[:abbr] == typed_stage
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
[typed_stage.first,
|
204
|
+
get_identifier.build_stage(
|
205
|
+
harmonized_code: get_identifier.build_harmonized_stage_code(typed_stage[1][:harmonized_stages]))]
|
206
|
+
end
|
207
|
+
|
208
|
+
# Resolve typed stage using stage harmonized stage code
|
209
|
+
# @param harmonized_code [HarmonizedStageCode]
|
210
|
+
# @return [Symbol, nil] typed stage or nil
|
211
|
+
def resolve_typed_stage(harmonized_code)
|
212
|
+
self::TYPED_STAGES.each do |k, v|
|
213
|
+
if (v[:harmonized_stages] & harmonized_code.stages) == harmonized_code.stages
|
214
|
+
return k
|
215
|
+
end
|
216
|
+
end
|
217
|
+
nil
|
218
|
+
end
|
219
219
|
end
|
220
220
|
end
|
221
221
|
end
|
data/lib/pubid/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pubid-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|