versionaire 8.3.0 → 9.0.0

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: bb162bc916245b6782d3451663d6ae53e09eb736a6423334b87a9f6b18f4fe47
4
- data.tar.gz: b57712183b4dec5ba02234b370f6e0daf69536f087bb3470956e67a5aae571ac
3
+ metadata.gz: b5bf3f6ca78ae9c031159e94ca9c756fa50b13cdec20d434695ae8a26126d7b0
4
+ data.tar.gz: b6d5c1ca4d9528e70885e9e5842d3bf32a884d3c18934c7e9d3300023fc7f583
5
5
  SHA512:
6
- metadata.gz: 21c38cc0d147bc20e6d0e891d9855bc9d55f4b96f5ec540d726f6ce12ac136c057fc4fc28cfd5bca4594b248aae76862159c07544230aee82d63d3b382776a04
7
- data.tar.gz: 78bc75b55d216cdbf34dff6b73f435b0a7685a699db719d6f8287cf32c36e25668fb216b43e40e2a8b803b53ffde6dd7bf75be177fed4dd61738da0ccf4d2566
6
+ metadata.gz: 8c1334716bba3802c6adb35c8be2f0066f6020314f92736d6fa935600aadf19d47c7313d6087e3bc6d7171e0dfab3472c4509fba6ff24684a4b731140ff60569
7
+ data.tar.gz: 65ae92c897c984976c44c2efa6e101af3d7fda55e6ecc3ee7990b56f1d7d6d3f324ed667dde497b3715b9f0fa6764bfb74268b1d98d6d4d887b1330478196ef6
Binary file
data.tar.gz.sig CHANGED
@@ -1,4 +1,3 @@
1
- b+�2��'%�m�E��6� )���f7njoq~Tk� ���3)c��Ž��R�O1�Q��'e���-]꿡�J����
2
- ���3æ�E���`Dl�Q��sv��ɸ����io�$)��0��{��FE�,N�.�]B6oѿ��mW�3�ĥ~�T���� �`I���χ��O��k4N�@�L7Vp���ήt5�x����o,�-MqepИ�@���\+D\�-�������"�85������������
3
- v
4
- ��4
1
+ �V��=Ȳ�`>�v}���,�ױ�9�� �9d+�i�x�����C��+ӑ�jJ,����_�𚆗BR
2
+ 3�G����%j����2.㞟�x���p#��{��RCՈQOy–0
3
+  ܡ��~=��E+ ӷ]o4���I�ފJ(b�(�b��z>a�b�o>�nq�J� ������p��N�z�_�"0�o�r�u�E�[��-��NNo�} ��[�hlf^��wam�\9�y�Ø�m������C̉��
@@ -6,6 +6,8 @@
6
6
 
7
7
  [link=http://badge.fury.io/rb/versionaire]
8
8
  image::https://badge.fury.io/rb/versionaire.svg[Gem Version]
9
+ [link=https://www.alchemists.io/projects/code_quality]
10
+ image::https://img.shields.io/badge/code_style-alchemists-brightgreen.svg[Alchemists Style Guide]
9
11
  [link=https://circleci.com/gh/bkuhlmann/versionaire]
10
12
  image::https://circleci.com/gh/bkuhlmann/versionaire.svg?style=svg[Circle CI Status]
11
13
 
@@ -53,10 +55,10 @@ A new version can be initialized in a variety of ways:
53
55
 
54
56
  [source,ruby]
55
57
  ----
56
- Versionaire::Version.new # "0.0.0"
57
- Versionaire::Version[major: 1] # "1.0.0"
58
- Versionaire::Version[major: 1, minor: 2] # "1.2.0"
59
- Versionaire::Version[major: 1, minor: 2, patch: 3] # "1.2.3"
58
+ Versionaire::Version.new # "0.0.0"
59
+ Versionaire::Version[major: 1] # "1.0.0"
60
+ Versionaire::Version[major: 1, minor: 2] # "1.2.0"
61
+ Versionaire::Version[major: 1, minor: 2, patch: 3] # "1.2.3"
60
62
  ----
61
63
 
62
64
  === Equality
@@ -72,18 +74,18 @@ version_a = Versionaire::Version[major: 1]
72
74
  version_b = Versionaire::Version[major: 2]
73
75
  version_c = Versionaire::Version[major: 1]
74
76
 
75
- version_a == version_a # true
76
- version_a == version_b # false
77
- version_a == version_c # true
77
+ version_a == version_a # true
78
+ version_a == version_b # false
79
+ version_a == version_c # true
78
80
  ----
79
81
 
80
82
  Knowning this, versions can be compared against one another too:
81
83
 
82
84
  [source,ruby]
83
85
  ----
84
- version_a > version_b # false
85
- version_a < version_b # true
86
- version_a.between? version_c, version_b # true
86
+ version_a > version_b # false
87
+ version_a < version_b # true
88
+ version_a.between? version_c, version_b # true
87
89
  ----
88
90
 
89
91
  ==== Hash (`#eql?`)
@@ -104,16 +106,16 @@ version_a = Versionaire::Version[major: 1]
104
106
  version_b = Versionaire::Version[major: 2]
105
107
  version_c = Versionaire::Version[major: 1]
106
108
 
107
- version_a.equal? version_a # true
108
- version_a.equal? version_b # false
109
- version_a.equal? version_c # false
109
+ version_a.equal? version_a # true
110
+ version_a.equal? version_b # false
111
+ version_a.equal? version_c # false
110
112
  ----
111
113
 
112
114
  === Conversions
113
115
 
114
- ==== Function (Casting)
116
+ ==== Function
115
117
 
116
- The `Versionaire::Version` function is provided for explicit casting to a version:
118
+ Use the `Versionaire::Version` function to explicitly cast to a version:
117
119
 
118
120
  [source,ruby]
119
121
  ----
@@ -126,7 +128,30 @@ Versionaire::Version version
126
128
  ----
127
129
 
128
130
  Each of these conversions will result in a version object that represents "`1.0.0`". When attempting
129
- to convert an unsupported type, a `+Versionaire::Errors::Conversion+` exception will be thrown.
131
+ to convert an unsupported type, a `+Versionaire::Errors::Cast+` exception will be thrown.
132
+
133
+ ==== Refinement
134
+
135
+ Building upon the examples shown above, there is an even more elegant solution where you can use
136
+ this gem's built-in link:https://www.alchemists.io/articles/ruby_refinements[refinement] support:
137
+
138
+ [source,ruby]
139
+ ----
140
+ using Versionaire::Cast
141
+
142
+ version = Versionaire::Version[major: 1]
143
+
144
+ Version "1.0.0"
145
+ Version [1, 0, 0]
146
+ Version major: 1, minor: 0, patch: 0
147
+ Version version
148
+ ----
149
+
150
+ By adding `using Versionaire::Cast` to your implementation, this allows Versionaire to refine
151
+ `Kernel` so you have a top-level `Version` conversion function much like Kernel's native support for
152
+ `Integer`, `String`, `Array`, `Hash`, etc. The benefit to this approach is it reduces the amount of
153
+ typing, doesn't polute your entire object space like a monkey patch would, and provides a idiomatic
154
+ approach to casting like any other primitive.
130
155
 
131
156
  ==== Implicit
132
157
 
@@ -134,7 +159,7 @@ Implicit conversion to a `+String+` is supported:
134
159
 
135
160
  [source,ruby]
136
161
  ----
137
- "1.0.0".match Versionaire::Version[major: 1] # <MatchData "1.0.0">
162
+ "1.0.0".match Versionaire::Version[major: 1] # <MatchData "1.0.0">
138
163
  ----
139
164
 
140
165
  ==== Explicit
@@ -145,9 +170,9 @@ Explicit conversion to a `String`, `Array`, or `Hash` is supported:
145
170
  ----
146
171
  version = Versionaire::Version.new
147
172
 
148
- version.to_s # "0.0.0"
149
- version.to_a # [0, 0, 0]
150
- version.to_h # {major: 0, minor: 0, patch: 0}
173
+ version.to_s # "0.0.0"
174
+ version.to_a # [0, 0, 0]
175
+ version.to_h # {major: 0, minor: 0, patch: 0}
151
176
  ----
152
177
 
153
178
  === Comparisons
@@ -160,39 +185,76 @@ work. Example:
160
185
  version_1 = Versionaire::Version "1.0.0"
161
186
  version_2 = Versionaire::Version "2.0.0"
162
187
 
163
- version_1 < version_2 # true
164
- version_1 <= version_2 # true
165
- version_1 == version_2 # false (see Equality section above for details)
166
- version_1 > version_2 # false
167
- version_1 >= version_2 # false
168
- version_1.between? version_1, version_2 # true
169
- version_1.clamp version_1, version_2 # version_1 (added in Ruby 2.4.0)
188
+ version_1 < version_2 # true
189
+ version_1 <= version_2 # true
190
+ version_1 == version_2 # false (see Equality section above for details)
191
+ version_1 > version_2 # false
192
+ version_1 >= version_2 # false
193
+ version_1.between? version_1, version_2 # true
194
+ version_1.clamp version_1, version_2 # version_1 (added in Ruby 2.4.0)
170
195
  ----
171
196
 
172
197
  === Math
173
198
 
174
- Versions can be added and subtracted from each other.
199
+ Versions can be added, subtracted, sequentially increased, or sequentially decreased from each
200
+ other.
175
201
 
176
202
  ==== Addition
177
203
 
204
+ Versions can be added together to produce a resulting version sum.
205
+
178
206
  [source,ruby]
179
207
  ----
180
208
  version_1 = Versionaire::Version[major: 1, minor: 2, patch: 3]
181
209
  version_2 = Versionaire::Version[major: 2, minor: 5, patch: 7]
182
- version_1 + version_2 # "3.7.10"
210
+ version_1 + version_2 # "3.7.10"
183
211
  ----
184
212
 
185
213
  ==== Subtraction
186
214
 
215
+ Versions can be substracted from each other as long as there isn't a negative result.
216
+
187
217
  [source,ruby]
188
218
  ----
189
219
  version_1 = Versionaire::Version[major: 1, minor: 2, patch: 3]
190
220
  version_2 = Versionaire::Version[major: 1, minor: 1, patch: 1]
191
- version_1 - version_2 # "0.1.2"
221
+ version_1 - version_2 # "0.1.2"
192
222
 
193
223
  version_1 = Versionaire::Version[major: 1]
194
224
  version_2 = Versionaire::Version[major: 5]
195
- version_1 - version_2 # Fails with a Versionaire::Errors::NegativeNumber
225
+ version_1 - version_2 # Versionaire::Errors::NegativeNumber
226
+ ----
227
+
228
+ ==== Up
229
+
230
+ Versions can be sequentially increased or given a specific version to jump to.
231
+
232
+ [source,ruby]
233
+ ----
234
+ version = Versionaire::Version[major: 1, minor: 1, patch: 1]
235
+ version.up :major # => "2.1.1"
236
+ version.up :major, 3 # => "4.1.1"
237
+ version.up :minor # => "1.2.1"
238
+ version.up :minor, 3 # => "1.4.1"
239
+ version.up :patch # => "1.1.2"
240
+ version.up :patch, 3 # => "1.1.4"
241
+ ----
242
+
243
+ ==== Down
244
+
245
+ Versions can be sequentially decreased or given a specific version to jump to as long as the result
246
+ is not negative.
247
+
248
+ [source,ruby]
249
+ ----
250
+ version = Versionaire::Version[major: 5, minor: 5, patch: 5]
251
+ version.down :major # => "4.5.5"
252
+ version.down :major, 3 # => "2.5.5"
253
+ version.down :minor # => "5.4.5"
254
+ version.down :minor, 3 # => "5.2.5"
255
+ version.down :patch # => "5.5.4"
256
+ version.down :patch, 3 # => "5.5.2"
257
+ version.down :major, 6 # => Versionaire::Errors::NegativeNumber
196
258
  ----
197
259
 
198
260
  == Development
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "versionaire/identity"
3
4
  require "versionaire/errors/base"
4
- require "versionaire/errors/conversion"
5
+ require "versionaire/errors/cast"
5
6
  require "versionaire/errors/invalid_number"
6
7
  require "versionaire/errors/negative_number"
7
- require "versionaire/filler"
8
- require "versionaire/conversion"
9
- require "versionaire/identity"
10
8
  require "versionaire/version"
9
+ require "versionaire/function"
10
+ require "versionaire/cast"
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Versionaire
4
+ # Refines Kernel in order to provide a top-level Version conversion function.
5
+ module Cast
6
+ refine Kernel do
7
+ def Version object
8
+ Versionaire::Version object
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Versionaire
4
+ module Errors
5
+ # Thrown when attempting to cast an invalid primitive to a version.
6
+ class Cast < Base
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "refinements/arrays"
4
+ require "refinements/structs"
5
+
3
6
  # The gem namespace.
4
7
  module Versionaire
5
8
  module_function
@@ -20,50 +23,48 @@ module Versionaire
20
23
 
21
24
  # Aids with converting objects into valid versions.
22
25
  class Converter
23
- def initialize object, filler: Filler.new
26
+ using Refinements::Arrays
27
+ using Refinements::Structs
28
+
29
+ def initialize object
24
30
  @object = object
25
- @filler = filler
26
31
  end
27
32
 
28
33
  def from_string
29
34
  body = "Use: <major>.<minor>.<patch>, <major>.<minor>, <major>, or empty string."
30
- fail Errors::Conversion, error_message(object, body) unless Version.regex.match? object
35
+ fail Errors::Cast, error_message(object, body) unless Version.pattern.match? object
31
36
 
32
- Version[**string_to_arguments]
37
+ string_to_version
33
38
  end
34
39
 
35
40
  def from_array
36
41
  body = "Use: [<major>, <minor>, <patch>], [<major>, <minor>], [<major>], or []."
37
- fail Errors::Conversion, error_message(object, body) unless (0..3).cover? object.size
42
+ fail Errors::Cast, error_message(object, body) unless (0..3).cover? object.size
38
43
 
39
- Version[**array_to_arguments]
44
+ Version.with_positions(*object.pad(0, max: 3))
40
45
  end
41
46
 
42
47
  def from_hash
43
48
  body = "Use: {major: <major>, minor: <minor>, patch: <patch>}, " \
44
49
  "{major: <major>, minor: <minor>}, {major: <major>}, or {}."
45
- fail Errors::Conversion, error_message(object, body) unless required_keys?
50
+ fail Errors::Cast, error_message(object, body) unless required_keys?
46
51
 
47
52
  Version[**object]
48
53
  end
49
54
 
50
55
  def from_object
51
- fail Errors::Conversion, error_message(object, "Use: String, Array, Hash, or Version.")
56
+ fail Errors::Cast, error_message(object, "Use: String, Array, Hash, or Version.")
52
57
  end
53
58
 
54
59
  private
55
60
 
56
61
  attr_reader :object, :filler
57
62
 
58
- def string_to_arguments
59
- object.split(DELIMITER)
63
+ def string_to_version
64
+ object.split(Version.delimiter)
60
65
  .map(&:to_i)
61
- .then { |numbers| filler.call numbers }
62
- .then { |arguments| Version.arguments(*arguments) }
63
- end
64
-
65
- def array_to_arguments
66
- Version.arguments(*filler.call(object))
66
+ .then { |numbers| numbers.pad 0, max: 3 }
67
+ .then { |arguments| Version.with_positions(*arguments) }
67
68
  end
68
69
 
69
70
  def required_keys?
@@ -5,7 +5,7 @@ module Versionaire
5
5
  module Identity
6
6
  NAME = "versionaire"
7
7
  LABEL = "Versionaire"
8
- VERSION = "8.3.0"
8
+ VERSION = "9.0.0"
9
9
  VERSION_LABEL = "#{LABEL} #{VERSION}"
10
10
  end
11
11
  end
@@ -1,41 +1,47 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Versionaire
4
- DELIMITER = "."
3
+ require "refinements/structs"
5
4
 
5
+ module Versionaire
6
6
  # An immutable, semantic version value object.
7
7
  Version = Struct.new :major, :minor, :patch, keyword_init: true do
8
8
  include Comparable
9
9
 
10
- def self.regex
10
+ using Refinements::Structs
11
+
12
+ def self.delimiter
13
+ "."
14
+ end
15
+
16
+ def self.pattern
11
17
  /
12
18
  \A( # Start of string and OR.
13
19
  \d* # Major only.
14
20
  | # OR pipe.
15
21
  \d+ # Major.
16
- #{DELIMITER}? # Delimiter.
22
+ #{delimiter}? # Delimiter.
17
23
  \d* # Minor.
18
- (?:#{DELIMITER}\d+) # Passive delimiter and patch.
24
+ (?:#{delimiter}\d+) # Passive delimiter and patch.
19
25
  )\z # End of OR and string.
20
26
  /x
21
27
  end
22
28
 
23
- def self.arguments major, minor, patch
24
- Hash[members.zip [major, minor, patch]]
25
- end
26
-
27
29
  def initialize major: 0, minor: 0, patch: 0
28
30
  super
29
31
  validate
30
32
  freeze
31
33
  end
32
34
 
35
+ def []= key, value
36
+ super(key, value).tap { validate }
37
+ end
38
+
33
39
  def + other
34
- self.class.then { |klass| klass.new(**klass.arguments(*reduce(other, :+))) }
40
+ revalue(other.to_h) { |previous, current| previous + current }
35
41
  end
36
42
 
37
43
  def - other
38
- self.class.then { |klass| klass.new(**klass.arguments(*reduce(other, :-))) }
44
+ revalue(other.to_h) { |previous, current| previous - current }
39
45
  end
40
46
 
41
47
  def == other
@@ -48,25 +54,26 @@ module Versionaire
48
54
  to_s <=> other.to_s
49
55
  end
50
56
 
51
- def to_s
52
- to_a.join DELIMITER
57
+ def down key, value = 1
58
+ revalue(key => value) { |previous, current| previous - current }
53
59
  end
54
60
 
55
- alias_method :to_str, :to_s
61
+ def up key, value = 1
62
+ revalue(key => value) { |previous, current| previous + current }
63
+ end
56
64
 
57
- def to_a
58
- [major, minor, patch]
65
+ def to_s
66
+ to_a.join self.class.delimiter
59
67
  end
60
68
 
69
+ alias_method :to_str, :to_s
70
+ alias_method :values, :to_a
71
+
61
72
  private
62
73
 
63
74
  def validate
64
75
  fail Errors::InvalidNumber if to_a.any? { |number| !number.is_a? Integer }
65
76
  fail Errors::NegativeNumber if to_a.any?(&:negative?)
66
77
  end
67
-
68
- def reduce other, action
69
- to_a.zip(other.to_a).map { |pair| pair.reduce action }
70
- end
71
78
  end
72
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: versionaire
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.3.0
4
+ version: 9.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -28,204 +28,22 @@ cert_chain:
28
28
  2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
29
29
  QWc=
30
30
  -----END CERTIFICATE-----
31
- date: 2020-10-18 00:00:00.000000000 Z
31
+ date: 2020-12-29 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
- name: bundler-audit
34
+ name: refinements
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '0.6'
40
- type: :development
39
+ version: '8.0'
40
+ type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '0.6'
47
- - !ruby/object:Gem::Dependency
48
- name: gemsmith
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '14.2'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '14.2'
61
- - !ruby/object:Gem::Dependency
62
- name: git-lint
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '1.0'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '1.0'
75
- - !ruby/object:Gem::Dependency
76
- name: guard-rspec
77
- requirement: !ruby/object:Gem::Requirement
78
- requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '4.7'
82
- type: :development
83
- prerelease: false
84
- version_requirements: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - "~>"
87
- - !ruby/object:Gem::Version
88
- version: '4.7'
89
- - !ruby/object:Gem::Dependency
90
- name: pry
91
- requirement: !ruby/object:Gem::Requirement
92
- requirements:
93
- - - "~>"
94
- - !ruby/object:Gem::Version
95
- version: '0.13'
96
- type: :development
97
- prerelease: false
98
- version_requirements: !ruby/object:Gem::Requirement
99
- requirements:
100
- - - "~>"
101
- - !ruby/object:Gem::Version
102
- version: '0.13'
103
- - !ruby/object:Gem::Dependency
104
- name: pry-byebug
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: '3.9'
110
- type: :development
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - "~>"
115
- - !ruby/object:Gem::Version
116
- version: '3.9'
117
- - !ruby/object:Gem::Dependency
118
- name: rake
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - "~>"
122
- - !ruby/object:Gem::Version
123
- version: '13.0'
124
- type: :development
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - "~>"
129
- - !ruby/object:Gem::Version
130
- version: '13.0'
131
- - !ruby/object:Gem::Dependency
132
- name: reek
133
- requirement: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - "~>"
136
- - !ruby/object:Gem::Version
137
- version: '6.0'
138
- type: :development
139
- prerelease: false
140
- version_requirements: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - "~>"
143
- - !ruby/object:Gem::Version
144
- version: '6.0'
145
- - !ruby/object:Gem::Dependency
146
- name: rspec
147
- requirement: !ruby/object:Gem::Requirement
148
- requirements:
149
- - - "~>"
150
- - !ruby/object:Gem::Version
151
- version: '3.9'
152
- type: :development
153
- prerelease: false
154
- version_requirements: !ruby/object:Gem::Requirement
155
- requirements:
156
- - - "~>"
157
- - !ruby/object:Gem::Version
158
- version: '3.9'
159
- - !ruby/object:Gem::Dependency
160
- name: rubocop
161
- requirement: !ruby/object:Gem::Requirement
162
- requirements:
163
- - - "~>"
164
- - !ruby/object:Gem::Version
165
- version: '0.89'
166
- type: :development
167
- prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- requirements:
170
- - - "~>"
171
- - !ruby/object:Gem::Version
172
- version: '0.89'
173
- - !ruby/object:Gem::Dependency
174
- name: rubocop-performance
175
- requirement: !ruby/object:Gem::Requirement
176
- requirements:
177
- - - "~>"
178
- - !ruby/object:Gem::Version
179
- version: '1.5'
180
- type: :development
181
- prerelease: false
182
- version_requirements: !ruby/object:Gem::Requirement
183
- requirements:
184
- - - "~>"
185
- - !ruby/object:Gem::Version
186
- version: '1.5'
187
- - !ruby/object:Gem::Dependency
188
- name: rubocop-rake
189
- requirement: !ruby/object:Gem::Requirement
190
- requirements:
191
- - - "~>"
192
- - !ruby/object:Gem::Version
193
- version: '0.5'
194
- type: :development
195
- prerelease: false
196
- version_requirements: !ruby/object:Gem::Requirement
197
- requirements:
198
- - - "~>"
199
- - !ruby/object:Gem::Version
200
- version: '0.5'
201
- - !ruby/object:Gem::Dependency
202
- name: rubocop-rspec
203
- requirement: !ruby/object:Gem::Requirement
204
- requirements:
205
- - - "~>"
206
- - !ruby/object:Gem::Version
207
- version: '1.39'
208
- type: :development
209
- prerelease: false
210
- version_requirements: !ruby/object:Gem::Requirement
211
- requirements:
212
- - - "~>"
213
- - !ruby/object:Gem::Version
214
- version: '1.39'
215
- - !ruby/object:Gem::Dependency
216
- name: simplecov
217
- requirement: !ruby/object:Gem::Requirement
218
- requirements:
219
- - - "~>"
220
- - !ruby/object:Gem::Version
221
- version: '0.19'
222
- type: :development
223
- prerelease: false
224
- version_requirements: !ruby/object:Gem::Requirement
225
- requirements:
226
- - - "~>"
227
- - !ruby/object:Gem::Version
228
- version: '0.19'
46
+ version: '8.0'
229
47
  description:
230
48
  email:
231
49
  - brooke@alchemists.io
@@ -238,12 +56,12 @@ files:
238
56
  - LICENSE.adoc
239
57
  - README.adoc
240
58
  - lib/versionaire.rb
241
- - lib/versionaire/conversion.rb
59
+ - lib/versionaire/cast.rb
242
60
  - lib/versionaire/errors/base.rb
243
- - lib/versionaire/errors/conversion.rb
61
+ - lib/versionaire/errors/cast.rb
244
62
  - lib/versionaire/errors/invalid_number.rb
245
63
  - lib/versionaire/errors/negative_number.rb
246
- - lib/versionaire/filler.rb
64
+ - lib/versionaire/function.rb
247
65
  - lib/versionaire/identity.rb
248
66
  - lib/versionaire/version.rb
249
67
  homepage: https://www.alchemists.io/projects/versionaire
@@ -262,14 +80,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
262
80
  requirements:
263
81
  - - "~>"
264
82
  - !ruby/object:Gem::Version
265
- version: '2.7'
83
+ version: '3.0'
266
84
  required_rubygems_version: !ruby/object:Gem::Requirement
267
85
  requirements:
268
86
  - - ">="
269
87
  - !ruby/object:Gem::Version
270
88
  version: '0'
271
89
  requirements: []
272
- rubygems_version: 3.1.4
90
+ rubygems_version: 3.2.3
273
91
  signing_key:
274
92
  specification_version: 4
275
93
  summary: Provides an immutable, thread-safe, and semantic version type.
metadata.gz.sig CHANGED
Binary file
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Versionaire
4
- module Errors
5
- # Thrown when attempting to convert (cast) an invalid primitive to a version.
6
- class Conversion < Base
7
- end
8
- end
9
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Versionaire
4
- class Filler
5
- def initialize pad = 0, max: 2
6
- @pad = pad
7
- @max = max
8
- end
9
-
10
- def call array
11
- array.dup.fill pad, array.size..max
12
- end
13
-
14
- private
15
-
16
- attr_reader :pad, :max
17
- end
18
- end