relaton-bib 1.12.1 → 1.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/relaton_bib/contribution_info.rb +2 -2
 - data/lib/relaton_bib/contributor.rb +9 -9
 - data/lib/relaton_bib/document_relation_collection.rb +2 -2
 - data/lib/relaton_bib/hash_converter.rb +8 -2
 - data/lib/relaton_bib/series.rb +1 -1
 - data/lib/relaton_bib/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: ebde20c82020f6add84d243549e0300e43a92f3702173f646df61c10c8dab27a
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 6a4a26a79f56851700b37d5ded69b9a9b2eb69192d2f04efccb9a2ee56c7b2b4
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 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 
     | 
    
         
            -
                  {  
     | 
| 
      
 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 
     | 
| 
      
 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 
     | 
| 
      
 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 
     | 
    
         
            -
                       
     | 
| 
      
 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
         
     | 
    
        data/lib/relaton_bib/series.rb
    CHANGED
    
    | 
         @@ -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])
         
     | 
    
        data/lib/relaton_bib/version.rb
    CHANGED
    
    
    
        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. 
     | 
| 
      
 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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-07-19 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: byebug
         
     |