relaton-bib 1.8.1 → 1.8.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: f360e492005bad966ceffdf2c7b58dea17f15232579ce07c461ceeced55340d0
4
- data.tar.gz: 53dbb7362cb878464c4a98b215a10ce70b6bb2ff9e01aac4d20d029c3285b309
3
+ metadata.gz: 6ff7b6717bb451df99444b58ca6caa1e233508925c6a2d9004c9eab3507beacb
4
+ data.tar.gz: 38c1a9fefa8fea1982ad942de7451f5c72abe2e793f7023c380bae55b6008a39
5
5
  SHA512:
6
- metadata.gz: c9ad9144aada97110a49ee9e9f1fa3a6e75a6d7c2a02229c1093bdf73ad9dfd561b7c58da7345ef27081e3128ceb3dfbcad7d60051875b906c38cba090d35542
7
- data.tar.gz: 9f65d0bc5fbc719bce322e1b6f98668c764c292e1f047b04ddc7ca4b97257192e9f7b7ad3ec9c899ced8a4d4dfa88aa54a92bd38db37888eb4a680a57d8d1859
6
+ metadata.gz: 3c8515678e6d72e526dcda4d0a49ba6ceb95aae3cb5d7b1ccabda2f67502217f2faf2adab888af887423add502fd84ec7ed39fdd9fc25e2fb1b4d4848b9abba3
7
+ data.tar.gz: b7c41cb0c51b5853a6f1d6b97b9c0dd1152896913d240bbdc3c76ce847fa4b0a75ddd29e62261ec61257757642dba40b842300dfe85b2e90fe6e619505be308d
@@ -18,12 +18,8 @@ module RelatonBib
18
18
  # @param language [String] language code Iso639
19
19
  # @param script [String] script code Iso15924
20
20
  def initialize(content, language = nil, script = nil) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
21
- if content.is_a? Array
22
- inv = content.reject { |c| c.is_a?(LocalizedString) || c.is_a?(Hash) }
23
- end
24
- unless content.is_a?(String) || inv&.none? && content.any?
25
- klass = content.is_a?(Array) ? inv.first.class : content.class
26
- raise ArgumentError, "invalid LocalizedString content type: #{klass}"
21
+ if content.is_a?(Array) && content.none?
22
+ raise ArgumentError, "LocalizedString content is empty"
27
23
  end
28
24
  @language = language.is_a?(String) ? [language] : language
29
25
  @script = script.is_a?(String) ? [script] : script
@@ -31,6 +27,8 @@ module RelatonBib
31
27
  content.map do |c|
32
28
  if c.is_a?(Hash)
33
29
  LocalizedString.new c[:content], c[:language], c[:script]
30
+ elsif c.is_a?(String)
31
+ LocalizedString.new c
34
32
  else c
35
33
  end
36
34
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonBib
2
- VERSION = "1.8.1".freeze
2
+ VERSION = "1.8.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.8.1
4
+ version: 1.8.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-05-31 00:00:00.000000000 Z
11
+ date: 2021-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug