versionaire 15.2.0 → 15.3.0
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
- checksums.yaml.gz.sig +0 -0
- data/README.adoc +35 -1
- data/lib/versionaire/version.rb +20 -0
- data/versionaire.gemspec +1 -1
- data.tar.gz.sig +4 -3
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 51ca8549d8d7dc88b44bafa73e5cf4a15b8e804091753289edab08fc1d03acc7
|
|
4
|
+
data.tar.gz: 4098d37c05c2ba2f96c387d398eb49e3502110dfd227614aa51ad6df95fb0d84
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 188dcf5dc8f8a59a9b1778a8cdec8147e19f95003e689fda7229e9912041d43f7d832442992495e21afaa10feb51acc4d482cb2eb7379672a0689e7a55faefae
|
|
7
|
+
data.tar.gz: 78a99008e5ed1818b3e889833758dcee38f835f237a2b83deba838d1c215c720aceae6780e2aa26d635f2a7df4c78305528f41184c96ec37172982f1df2799f5
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/README.adoc
CHANGED
|
@@ -183,7 +183,7 @@ version.to_h # {major: 0, minor: 0, patch: 0}
|
|
|
183
183
|
version.to_proc # #<Proc:0x000000010b015b88 (lambda)>
|
|
184
184
|
----
|
|
185
185
|
|
|
186
|
-
To elaborate on procs, this means the following is possible where you might want to collect all minor
|
|
186
|
+
To elaborate on procs, this means the following is possible where you might want to collect all minor version values or make use of version information in other useful ways:
|
|
187
187
|
|
|
188
188
|
[source,ruby]
|
|
189
189
|
----
|
|
@@ -195,6 +195,20 @@ version.to_proc.call :major # 1
|
|
|
195
195
|
[version, version, version].map(&:minor) # [2, 2, 2]
|
|
196
196
|
----
|
|
197
197
|
|
|
198
|
+
=== Kinds
|
|
199
|
+
|
|
200
|
+
You can ask what kind the version is:
|
|
201
|
+
|
|
202
|
+
[source,ruby]
|
|
203
|
+
----
|
|
204
|
+
Version("1.1.1").kind # :patch
|
|
205
|
+
Version("1.1.0").kind # :minor
|
|
206
|
+
Version("1.0.0").kind # :major
|
|
207
|
+
Version("0.1.0").kind # :minor
|
|
208
|
+
Version("0.0.1").kind # :patch
|
|
209
|
+
Version("0.0.0").kind # :nascent
|
|
210
|
+
----
|
|
211
|
+
|
|
198
212
|
=== Inspections
|
|
199
213
|
|
|
200
214
|
You can inspect a version which is the equivalent of an escaped string representation. Example:
|
|
@@ -206,6 +220,26 @@ using Versionaire::Cast
|
|
|
206
220
|
Version("1.2.3").inspect # "\"1.2.3\""
|
|
207
221
|
----
|
|
208
222
|
|
|
223
|
+
You can also ask if a version is a major, minor, or patch. Example:
|
|
224
|
+
|
|
225
|
+
[source,ruby]
|
|
226
|
+
----
|
|
227
|
+
Version("1.0.0").major? # true
|
|
228
|
+
Version("0.1.0").major? # false
|
|
229
|
+
Version("0.0.1").major? # false
|
|
230
|
+
Version("0.0.0").major? # false
|
|
231
|
+
|
|
232
|
+
Version("1.0.0").minor? # false
|
|
233
|
+
Version("0.1.0").minor? # true
|
|
234
|
+
Version("0.0.1").minor? # false
|
|
235
|
+
Version("0.0.0").minor? # false
|
|
236
|
+
|
|
237
|
+
Version("1.0.0").patch? # false
|
|
238
|
+
Version("0.1.0").patch? # false
|
|
239
|
+
Version("0.0.1").patch? # true
|
|
240
|
+
Version("0.0.0").patch? # false
|
|
241
|
+
----
|
|
242
|
+
|
|
209
243
|
=== Comparisons
|
|
210
244
|
|
|
211
245
|
All versions are comparable which means any of the operators from the `+Comparable+` module will
|
data/lib/versionaire/version.rb
CHANGED
|
@@ -39,6 +39,26 @@ module Versionaire
|
|
|
39
39
|
|
|
40
40
|
def inspect = to_s.inspect
|
|
41
41
|
|
|
42
|
+
def kind
|
|
43
|
+
if major? then :major
|
|
44
|
+
elsif minor? then :minor
|
|
45
|
+
elsif patch? then :patch
|
|
46
|
+
else :nascent
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def major? = major.positive? && minor.zero? && patch.zero?
|
|
51
|
+
|
|
52
|
+
def minor?
|
|
53
|
+
nonmajor = major.zero?
|
|
54
|
+
nonpatch = patch.zero?
|
|
55
|
+
|
|
56
|
+
!(nonmajor && minor.zero? && nonpatch) &&
|
|
57
|
+
(nonmajor || major.positive?) && minor.positive? && nonpatch
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def patch? = patch.positive?
|
|
61
|
+
|
|
42
62
|
def to_proc = method(:public_send).to_proc
|
|
43
63
|
|
|
44
64
|
def to_s = to_a.join DELIMITER
|
data/versionaire.gemspec
CHANGED
data.tar.gz.sig
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
�rB�c��%�f
|
|
2
|
+
0���m��'���=�ң7��@�?$����l��I�?R�ǿ�+�ֺ#��-���D����2�c��;��nkI���Dh��-ÿMvb���OԇA��
|
|
3
|
+
��E�}vuU�*\7]mL-��J$6"!4�hBÍue�Z~@�B��:�&�`��x��������iE9�^"�?��e���:�{�/�Y���o�(֚մ�
|
|
4
|
+
н�@� �����%"+���-��g�B]����:F�����[l�`���@���i�S�!yV�{�r͜��n:(�~����劏�¹�Zo�vv�R0�sT1�8���)�^#R����._37�Ui+������P�!�E�;��Z����Ylt:ć��R��A��X�
|
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: 15.
|
|
4
|
+
version: 15.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brooke Kuhlmann
|
|
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
91
91
|
- !ruby/object:Gem::Version
|
|
92
92
|
version: '0'
|
|
93
93
|
requirements: []
|
|
94
|
-
rubygems_version: 4.0.
|
|
94
|
+
rubygems_version: 4.0.12
|
|
95
95
|
specification_version: 4
|
|
96
96
|
summary: An immutable, thread-safe, and strict semantic version type.
|
|
97
97
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|