relaton-bipm 1.14.5 → 1.14.6

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: e0d5eb5717b605c2d3eec083e4ca529ccafb140246b1b8a042137d1025b41abb
4
- data.tar.gz: bdef48071e8e5ab07d643e54fed9f21c38d29119927620216a23d2d2d9c84a7b
3
+ metadata.gz: f72520efca5d2a8525b052758d95563c5ca6d57d22b85b146e4ff77e02ee2594
4
+ data.tar.gz: 57803ee16e558e356c0529599ffa8ba881ef85dba99d8b28a1f936a577f711f7
5
5
  SHA512:
6
- metadata.gz: '09e75649f7ca561179506cf24c0eb9c06b2c2e6241aac712e3aaa01e85985542d7086d907068acc365b0b93386e83160646e41d67585b1c9a8e98c8b5c281f55'
7
- data.tar.gz: ca8540f40846fe5d92b0b2da284c72cb3a44a4dfd580ad4a51eb6c625cfd400aa59b7a435c46af45244540482d02aff1bd9aa70b3cc5359a41b873602b5d5ecd
6
+ metadata.gz: e44f8da41d1c91944196344e85921988c14e5771f976af31471b14bfa216084717942b43b5e3ddc0053891c23e5bb4b7c9d4d9f07ad1abd9b825028fb2b49cd1
7
+ data.tar.gz: 1b6de32f1454222514c9867d86a1bf970d0b42fce78b8f927459e8907a9715ebaf45c17366acfbe2112599fd3c07fc5a93d9729fd43e7565e67dee6acbeb52c3
@@ -230,15 +230,6 @@ module RelatonBipm
230
230
  # @param [String] path path to YAML file
231
231
  #
232
232
  def add_to_index(item, path) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
233
- # key = [item.docnumber]
234
- # SHORTTYPE.each do |k, v|
235
- # if item.docnumber.include? k
236
- # key << item.docnumber.sub(k, v)
237
- # key << item.docnumber.sub(k, v).sub(/(\(\d{4})(\))/, "\\1, EN\\2")
238
- # key << item.docnumber.sub(k, v).sub(/(\(\d{4})(\))/, "\\1, FR\\2")
239
- # break
240
- # end
241
- # end
242
233
  key = item.docidentifier.select { |i| i.type == "BIPM" }.map &:id
243
234
  @data_fetcher.index[key] = path
244
235
  @data_fetcher.index_new.add_or_update key, path
@@ -254,20 +245,40 @@ module RelatonBipm
254
245
  #
255
246
  # @return [Array<Hash>] contributors
256
247
  #
257
- def contributors(date, body) # rubocop:disable Metrics/MethodLength
248
+ def contributors(date, body)
249
+ contribs = [{ entity: bipm_org, role: [{ type: "publisher" }] }]
250
+ author = author_org date, body
251
+ contribs << { entity: author, role: [{ type: "author" }] } if author
252
+ contribs
253
+ end
254
+
255
+ #
256
+ # Create author organization
257
+ #
258
+ # @param [String] date date of publication
259
+ # @param [String] body organization abbreviation (CCTF, CIPM, CGPM)
260
+ #
261
+ # @return [Hash, nil] author organization
262
+ #
263
+ def author_org(date, body)
258
264
  case body
259
265
  when "CCTF" then cctf_org date
260
266
  when "CGPM" then cgpm_org
261
267
  when "CIPM" then cipm_org
262
- else []
263
- end.reduce(
264
- [{ entity: {
265
- url: "www.bipm.org",
266
- name: "Bureau International des Poids et Mesures",
267
- abbreviation: "BIPM",
268
- },
269
- role: [{ type: "publisher" }] }],
270
- ) { |a, e| a << { entity: e, role: [{ type: "author" }] } }
268
+ end
269
+ end
270
+
271
+ #
272
+ # Create BIPM organization
273
+ #
274
+ # @return [Hash] BIPM organization
275
+ #
276
+ def bipm_org
277
+ nms = [
278
+ { content: "International Bureau of Weights and Measures", language: "en" },
279
+ { content: "Bureau international des poids et mesures", language: "fr" },
280
+ ]
281
+ organization(nms, "BIPM").tap { |org| org[:url] = "www.bipm.org" }
271
282
  end
272
283
 
273
284
  #
@@ -275,7 +286,7 @@ module RelatonBipm
275
286
  #
276
287
  # @param [String] date date of meeting
277
288
  #
278
- # @return [Array<Hash>] CCTF organization
289
+ # @return [Hash] CCTF organization
279
290
  #
280
291
  def cctf_org(date) # rubocop:disable Metrics/MethodLength
281
292
  if Date.parse(date).year < 1999
@@ -299,17 +310,17 @@ module RelatonBipm
299
310
  # @param [Array<Hash>] names organization names in different languages
300
311
  # @param [String] abbr abbreviation
301
312
  #
302
- # @return [Array<Hash>] organization
313
+ # @return [Hash] organization
303
314
  #
304
315
  def organization(names, abbr)
305
316
  names.each { |ctrb| ctrb[:script] = "Latn" }
306
- [{ name: names, abbreviation: { content: abbr, language: ["en", "fr"], script: "Latn" } }]
317
+ { name: names, abbreviation: { content: abbr, language: ["en", "fr"], script: "Latn" } }
307
318
  end
308
319
 
309
320
  #
310
321
  # Create CGPM organization
311
322
  #
312
- # @return [Array<Hash>] CGPM organization
323
+ # @return [Hash] CGPM organization
313
324
  #
314
325
  def cgpm_org
315
326
  nms = [
@@ -1,3 +1,3 @@
1
1
  module RelatonBipm
2
- VERSION = "1.14.5".freeze
2
+ VERSION = "1.14.6".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bipm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.5
4
+ version: 1.14.6
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-05-02 00:00:00.000000000 Z
11
+ date: 2023-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml