relaton-iec 1.16.2 → 1.16.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 101c12e86e42473965841a2ba577d7ef661ad41cd3466ab5f3b4488675a8446a
|
4
|
+
data.tar.gz: be02f4aeeda35aab505380d35352b0f906b53efa680fbbf139364fcd90a8952b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cd438a1c74b7b79f7a2ac3a909543a15cecc20c96c36fe2a83223088cafee149e5e33c32bcabfa7fac8adc893bed21ac7cb2e561373b8c15d7c39f50979b303
|
7
|
+
data.tar.gz: 8e579abea1e3e46268999b9d68658761778ce10caee7f6a571d7286a0f86507e1649025ef4fd152a96c11075fd2b99cbc88e4e87df942447ae8c9d2cc26a8857
|
@@ -177,12 +177,12 @@ module RelatonIec
|
|
177
177
|
# has a title (amendments do not).
|
178
178
|
# If no match, returns any years which caused mismatch, for error reporting
|
179
179
|
def results_filter(result, ref, year, opts)
|
180
|
-
r_code, r_year, r_amd = code_year ref
|
180
|
+
r_code, r_year, r_amd, r_consv = code_year ref
|
181
181
|
r_year ||= year
|
182
182
|
if opts[:all_parts]
|
183
183
|
ret = result.to_all_parts(r_year)
|
184
184
|
else
|
185
|
-
ret, missed_parts = match_result(result, r_code, r_year, r_amd)
|
185
|
+
ret, missed_parts = match_result(result, r_code, r_year, r_amd, r_consv)
|
186
186
|
end
|
187
187
|
{ ret: ret, years: missed_years(result, r_year), missed_parts: missed_parts }
|
188
188
|
end
|
@@ -198,23 +198,27 @@ module RelatonIec
|
|
198
198
|
# @param [String] code code of the document
|
199
199
|
# @param [String] year year of the document
|
200
200
|
# @param [String] amd amendment of the document
|
201
|
+
# @param [String] consv consolidated version of the document
|
201
202
|
#
|
202
203
|
# @return [Array<RelatonIec::IecBibliographicItem, Array, nil>] result, missed parts
|
203
204
|
#
|
204
|
-
def match_result(result, code, year, amd) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity
|
205
|
+
def match_result(result, code, year, amd, consv) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity
|
205
206
|
missed_parts = false
|
206
|
-
|
207
|
-
h_codes, h_years, h_amds = codes_years h.hit[:code]
|
207
|
+
res = result.select do |h|
|
208
|
+
h_codes, h_years, h_amds, h_consv = codes_years h.hit[:code]
|
208
209
|
match_code = h_codes.include? code
|
209
210
|
match_year = h_years.include?(year)
|
210
211
|
missed_parts ||= !match_code
|
211
|
-
match_code && (!year || match_year) && match_amd(amd, h_amds)
|
212
|
-
end
|
212
|
+
match_code && (!year || match_year) && match_amd(amd, h_amds) && h_consv.first == consv
|
213
|
+
end
|
214
|
+
hit = year ? res.first : res.max_by { |h| code_year(h.hit[:code])[1].to_i }
|
215
|
+
ret = hit&.fetch
|
213
216
|
[ret, missed_parts]
|
214
217
|
end
|
215
218
|
|
216
219
|
def match_amd(amd, h_amds)
|
217
|
-
(!amd && h_amds.empty?) || h_amds.include?(amd)
|
220
|
+
# (!amd && h_amds.empty?) || h_amds.include?(amd)
|
221
|
+
h_amds.first == amd
|
218
222
|
end
|
219
223
|
|
220
224
|
# @param ref [String]
|
@@ -225,8 +229,9 @@ module RelatonIec
|
|
225
229
|
^(?<code>\S+\s[^:/]+)
|
226
230
|
(?::(?<year>\d{4}))?
|
227
231
|
(?:/(?<amd>\w+)(?::\d{4})?)?
|
232
|
+
(?:\+(?<consv>\w+)(?::\d{4})?)?
|
228
233
|
}x =~ ref
|
229
|
-
[code, year, amd&.upcase]
|
234
|
+
[code, year, amd&.upcase, consv&.upcase]
|
230
235
|
end
|
231
236
|
|
232
237
|
# @param ref [String]
|
data/lib/relaton_iec/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-iec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.16.
|
4
|
+
version: 1.16.4
|
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-
|
11
|
+
date: 2023-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|