relaton-bib 1.12.1 → 1.12.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: e0b1ea12faaf38ba10b73a5febe3ac1740c9746319b7a20038c263373ea3dd25
4
- data.tar.gz: ef008d6e8283479a0daec628bd7cb22219ff77ff4a53813b64478d916e0f4de1
3
+ metadata.gz: ebde20c82020f6add84d243549e0300e43a92f3702173f646df61c10c8dab27a
4
+ data.tar.gz: 6a4a26a79f56851700b37d5ded69b9a9b2eb69192d2f04efccb9a2ee56c7b2b4
5
5
  SHA512:
6
- metadata.gz: a279a45bb36054842755b1ca417865a61caaa913bdff2847672649688ff2c08d051cccb5ad13b7fd650a893c442dddd533e9d45cc7847964f6938f63ecabaa80
7
- data.tar.gz: 4a6782ace9e988681e61422acc62bd14117e1188041bddda5d5e6c213b1eb2f1c4f7c7d1d646e7502a33260ef1e58b4fd12ba50e3e3f3a7ccb8cd1d8fcda3d86
6
+ metadata.gz: d99a477188088aeec02dd56732eb49517ee457186b334833c8fb22a9ea51ac49552fb7c963cc22a4d3230b378904a1603534991718eb620c96016323034ab956
7
+ data.tar.gz: cd5006e735cc8ff49b9c6fa910980b947691c14c725259f5843495722f5c0706a82f81d770fc11da2aa899d48654c963d87ec14aa15e5b361068f50fd83df48b
@@ -59,8 +59,8 @@ module RelatonBib
59
59
  # @param count [Integer] number of contributors
60
60
  # 2return [String]
61
61
  def to_asciibib(prefix = "", count = 1)
62
- pref = prefix.empty? ? prefix : prefix + "."
63
- out = count > 1 ? "#{prefix}::\n" : ""
62
+ pref = prefix.empty? ? prefix : "#{prefix}."
63
+ out = count > 1 ? "#{prefix}.role::\n" : ""
64
64
  description.each do |d|
65
65
  out += d.to_asciibib "#{pref}role.description", description.size
66
66
  end
@@ -46,12 +46,12 @@ module RelatonBib
46
46
 
47
47
  # @return [Hash]
48
48
  def to_hash # rubocop:disable Metrics/AbcSize
49
- hash = {}
50
- hash["street"] = street if street&.any?
51
- hash["city"] = city
52
- hash["state"] = state if state
53
- hash["country"] = country
54
- hash["postcode"] = postcode if postcode
49
+ hash = { "address" => {} }
50
+ hash["address"]["street"] = street if street&.any?
51
+ hash["address"]["city"] = city
52
+ hash["address"]["state"] = state if state
53
+ hash["address"]["country"] = country
54
+ hash["address"]["postcode"] = postcode if postcode
55
55
  hash
56
56
  end
57
57
 
@@ -92,7 +92,7 @@ module RelatonBib
92
92
 
93
93
  # @return [Hash]
94
94
  def to_hash
95
- { "type" => type, "value" => value }
95
+ { type => value }
96
96
  end
97
97
 
98
98
  # @param prefix [String]
@@ -101,8 +101,8 @@ module RelatonBib
101
101
  def to_asciibib(prefix = "", count = 1)
102
102
  pref = prefix.empty? ? prefix : "#{prefix}."
103
103
  out = count > 1 ? "#{pref}contact::\n" : ""
104
- out += "#{pref}contact.type:: #{type}\n"
105
- out += "#{pref}contact.value:: #{value}\n"
104
+ # out += "#{pref}contact.type:: #{type}\n"
105
+ out += "#{pref}contact.#{type}:: #{value}\n"
106
106
  out
107
107
  end
108
108
  end
@@ -6,7 +6,7 @@ module RelatonBib
6
6
  extend Forwardable
7
7
 
8
8
  def_delegators :@array, :<<, :[], :first, :last, :empty?, :any?, :size,
9
- :each, :detect, :map, :reduce, :length
9
+ :each, :detect, :map, :reduce, :length, :unshift
10
10
 
11
11
  # @param relation [Array<RelatonBib::DocumentRelation, Hash>]
12
12
  # @option relation [String] :type
@@ -32,7 +32,7 @@ module RelatonBib
32
32
  # @param prefix [String]
33
33
  # @return [String]
34
34
  def to_asciibib(prefix = "")
35
- pref = prefix.empty? ? "relation" : prefix + ".relation"
35
+ pref = prefix.empty? ? "relation" : "#{prefix}.relation"
36
36
  out = ""
37
37
  @array.each do |r|
38
38
  out += size > 1 ? "#{pref}::\n" : ""
@@ -279,13 +279,19 @@ module RelatonBib
279
279
  return [] unless entity[:contact]
280
280
 
281
281
  RelatonBib.array(entity[:contact]).map do |a|
282
- if a[:city] || a[:country]
282
+ if a[:city] || a[:country] # it's for old version compatibility, should be removed in the future
283
283
  RelatonBib::Address.new(
284
284
  street: Array(a[:street]), city: a[:city], postcode: a[:postcode],
285
285
  country: a[:country], state: a[:state]
286
286
  )
287
- else
287
+ elsif a[:address]
288
+ a[:address][:street] = RelatonBib.array(a[:address][:street])
289
+ RelatonBib::Address.new(**a[:address])
290
+ elsif a[:type] # it's for old version compatibility, should be removed in the future
288
291
  RelatonBib::Contact.new(type: a[:type], value: a[:value])
292
+ else
293
+ type, value = a.flatten
294
+ RelatonBib::Contact.new(type: type.to_s, value: value)
289
295
  end
290
296
  end
291
297
  end
@@ -37,7 +37,7 @@ module RelatonBib
37
37
  # @param run [String, nil]
38
38
  def initialize(**args)
39
39
  unless args[:title].is_a?(RelatonBib::TypedTitleString)
40
- raise ArgumentError, "argument `title` should present"
40
+ raise ArgumentError, "argument `title` should present in series"
41
41
  end
42
42
 
43
43
  # if args[:type] && !TYPES.include?(args[:type])
@@ -1,3 +1,3 @@
1
1
  module RelatonBib
2
- VERSION = "1.12.1".freeze
2
+ VERSION = "1.12.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.12.1
4
+ version: 1.12.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: 2022-06-28 00:00:00.000000000 Z
11
+ date: 2022-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug