relaton-gb 1.0.1 → 1.0.2

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: f93326a031ad54aa4699846ee3bb52477bb08c53cb565240ba7307b7201e73ce
4
- data.tar.gz: fb559ed0b92b162c75e3acf5cd7db6af18a4ecb753320b5f25b45dec282c52e2
3
+ metadata.gz: 8675991461b657f6d624391f50115245029e999fc9ea076bef99e7f8bdeb3ece
4
+ data.tar.gz: d3eb20d7a6302ea10ada5732370972e631db752eb8febb592f75c96d5f030e67
5
5
  SHA512:
6
- metadata.gz: a4b21425dbfed6364955e9a926afe30eb2e02278171323efa22d6195ed62960f6c1b6885164cf6b66c57ea37fec28105af362a4218ad4338d107ddc016c2ef6a
7
- data.tar.gz: dfa27dffa74247af4bc73047614e8616b96aedef127fb357f013c0d6488b06a1cc3a0d3dd0bd86f3c2d2cbf28a206a5d97752fb816cf60480012093cc3c6a72a
6
+ metadata.gz: aa28fc07245bbc86dd03ce11c284ea30becb75287efd48a1621890d4180dc4338d28bbae928d49529acc6d834b169fd3c5a54292c7c5996cb89c7e5773d9c5aa
7
+ data.tar.gz: 60b54b035542086d2849f7781837c4a72530ac4f42fc55f451961497a71478853bead48ff7e1c04ee57ad8d34b54b4169c5ee145d0cb43042933ad6506c4d9a2
@@ -55,18 +55,28 @@ module RelatonGb
55
55
  # @param docref [Strings]
56
56
  # @return [Array<Hash>]
57
57
  def get_contributors(doc, docref)
58
- gb_en = GbAgencies::Agencies.new("en", {}, "")
59
- gb_zh = GbAgencies::Agencies.new("zh", {}, "")
60
58
  name = docref.match(/^[^\s]+/).to_s
61
59
  name.sub!(%r{/[TZ]$}, "") unless name =~ /^GB/
62
60
  gbtype = get_gbtype(doc, docref)
63
- entity = RelatonBib::Organization.new name: [
64
- { language: "en", content: gb_en.standard_agency1(gbtype[:scope], name, gbtype[:mandate]) },
65
- { language: "zh", content: gb_zh.standard_agency1(gbtype[:scope], name, gbtype[:mandate]) },
66
- ]
61
+ orgs = %w[en zh].map { |l| org(l, name, gbtype) }.compact
62
+ return [] unless orgs.any?
63
+
64
+ entity = RelatonBib::Organization.new name: orgs
67
65
  [{ entity: entity, role: [type: "publisher"] }]
68
66
  end
69
67
 
68
+ # @param lang [String]
69
+ # @param name [String]
70
+ # @param gbtype [Hash]
71
+ # @return [Hash]
72
+ def org(lang, name, gbtype)
73
+ ag = GbAgencies::Agencies.new(lang, {}, "")
74
+ content = ag.standard_agency1(gbtype[:scope], name, gbtype[:mandate])
75
+ return unless content
76
+
77
+ { language: lang, content: content }
78
+ end
79
+
70
80
  # @param doc [Nokogiri::HTML::Document]
71
81
  # @return [Array<Hash>]
72
82
  # * :title_intro [String]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RelatonGb
4
- VERSION = "1.0.1"
4
+ VERSION = "1.0.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-gb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.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: 2020-05-20 00:00:00.000000000 Z
11
+ date: 2020-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: debase