relaton-bib 1.9.1 → 1.9.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: 34028dd6a06df2ea4fb4280dc523e142d603dcb5e3c9b32c500823b6d6d4be4e
4
- data.tar.gz: 6a43437d26b84c0049a0292896116a705a5c0595ee5f292794ffc780e7c720c8
3
+ metadata.gz: 159e7430eaae042b7130807811e748afeede73d727c865d06a3acedd03e5de08
4
+ data.tar.gz: 69c3efa7687a851d14aee6a22878b4359928eb692371313384f4332bd1dee068
5
5
  SHA512:
6
- metadata.gz: 3af6adfc91e4a4dd6da9401b991949f2ea15230abe59e46aff4d43d88e7c0feae7a3fc818280cbb36f39ebce85013f7f61865c85988c2f72c261f2fdbb9e9f35
7
- data.tar.gz: e5476c5071889ffec592312c5d2fe0534c2ab72c006f03d7429c9504981a32c93dd4274cdf305914089193943b0b2bdcea6b85e4973e815e2a3ed996a1b0816e
6
+ metadata.gz: 02bc4eceac45f0e63be85121b73a68db0c66625b917d108a5ebde58a6e975373a0e95f9e2b30a056f1551de18357cfeb49c89804758385cbf5e324513fe6037c
7
+ data.tar.gz: b2cebd03f70db311a4839c4543f02d2011dbed485d79c7823023dd088381424fc9070bf885cd5232d8eef6841c8d8fdd7cb434d61ba93b9c8457635684cbc601
@@ -207,6 +207,7 @@ module RelatonBib
207
207
  org[:subdivision] = array(org[:subdivision]).map do |sd|
208
208
  LocalizedString.new sd
209
209
  end
210
+ org[:contact] = contacts_hash_to_bib(org)
210
211
  org
211
212
  end
212
213
 
@@ -256,10 +257,10 @@ module RelatonBib
256
257
  end
257
258
  end
258
259
 
259
- def contacts_hash_to_bib(person) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
260
- return [] unless person[:contact]
260
+ def contacts_hash_to_bib(entity) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
261
+ return [] unless entity[:contact]
261
262
 
262
- array(person[:contact]).map do |a|
263
+ array(entity[:contact]).map do |a|
263
264
  if a[:city] || a[:country]
264
265
  RelatonBib::Address.new(
265
266
  street: Array(a[:street]), city: a[:city], postcode: a[:postcode],
@@ -21,14 +21,15 @@ module RelatonBib
21
21
  if content.is_a?(Array) && content.none?
22
22
  raise ArgumentError, "LocalizedString content is empty"
23
23
  end
24
+
24
25
  @language = language.is_a?(String) ? [language] : language
25
26
  @script = script.is_a?(String) ? [script] : script
26
27
  @content = if content.is_a?(Array)
27
28
  content.map do |c|
28
- if c.is_a?(Hash)
29
+ case c
30
+ when Hash
29
31
  LocalizedString.new c[:content], c[:language], c[:script]
30
- elsif c.is_a?(String)
31
- LocalizedString.new c
32
+ when String then LocalizedString.new c
32
33
  else c
33
34
  end
34
35
  end
@@ -38,7 +39,7 @@ module RelatonBib
38
39
 
39
40
  # @return [String]
40
41
  def to_s
41
- content.is_a?(String) ? content : content.first.to_s
42
+ content.is_a?(Array) ? content.first.to_s : content.to_s
42
43
  end
43
44
 
44
45
  # @return [TrueClass, FalseClass]
@@ -1,3 +1,3 @@
1
1
  module RelatonBib
2
- VERSION = "1.9.1".freeze
2
+ VERSION = "1.9.2".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-bib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 1.9.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: 2021-08-30 00:00:00.000000000 Z
11
+ date: 2021-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug