pubid-core 0.1.7 → 0.1.8

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: 9895b8d56bf37310135d11148c71ea31514d203a4157b6d6bcb9a4d4df81be58
4
- data.tar.gz: 92d7bc8de5d97c2bda090ba2e2056819d29a31fff22f67495a7a4947ffaecc98
3
+ metadata.gz: 64a6316ad207f1d35b7c91406887d54cdb839765ce1d7aed4fc4a2ce5c27b9ce
4
+ data.tar.gz: 9b54bb81e84b0e90a46e70ddbdf48c0cb73438e84c66c6e144bd010954f475ae
5
5
  SHA512:
6
- metadata.gz: 57ad7508563a1bd967e6d60ff78faa2ea7a26e954a001545f0220ccfbbfe6efe935d7d0f8e9a0dec06ef27fb93e5620c6a1e3ca50a43a71b019e63d5bfab4a6b
7
- data.tar.gz: 0eda4ada9150f10b557a57610f802463773e8573c6f059180cec900ca769e205aa08e51e17d7152b11be88d57fd261b9b1b19d22f5744b51711b5ad1363569d8
6
+ metadata.gz: b18da4c3bb53562b9556948b631be4525d62b9bd244f93889328c6359f73df90c1159f8a08ace0d641644255ac072c8378a48e3f720b909dce8cafa6d8a1deeb
7
+ data.tar.gz: be5beb7da4ef8741504375c6a044a3a400fda9edf4eac1c2042fa9ea3516d7656dbdb200156d6fbf77402d57106e974124f145046bc38627538651f2c2fe4944
@@ -50,11 +50,11 @@ module Pubid::Core::Renderer
50
50
  end
51
51
 
52
52
  def render_amendments(amendments, _opts, _params)
53
- amendments.map(&:render_pubid).join("+")
53
+ amendments.sort.map(&:render_pubid).join("+")
54
54
  end
55
55
 
56
56
  def render_corrigendums(corrigendums, _opts, _params)
57
- corrigendums.map(&:render_pubid).join("+")
57
+ corrigendums.sort.map(&:render_pubid).join("+")
58
58
  end
59
59
 
60
60
  def render_type(type, opts, params)
@@ -1,13 +1,18 @@
1
1
  module Pubid::Core
2
2
  class Supplement
3
- attr_accessor :version, :number, :stage
3
+ include Comparable
4
+ attr_accessor :version, :number
4
5
 
5
- def initialize(version:, number: nil, stage: nil)
6
- @version, @number, @stage = version, number, stage
6
+ def initialize(version:, number: nil)
7
+ @version, @number = version&.to_i, number&.to_i
7
8
  end
8
9
 
9
- def ==(other)
10
- other.version == version && (number.nil? || other.number == number) && (stage.nil? || other.stage == stage)
10
+ def <=>(other)
11
+ return 0 if number.nil? && other.number
12
+
13
+ return number <=> other.number if version == other.version
14
+
15
+ (version <=> other.version) || number <=> other.number
11
16
  end
12
17
 
13
18
  def render_pubid_number
@@ -1,5 +1,5 @@
1
1
  module Pubid
2
2
  module Core
3
- VERSION = "0.1.7".freeze
3
+ VERSION = "0.1.8".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubid-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
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-10 00:00:00.000000000 Z
11
+ date: 2022-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake