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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32278a19824be583fa1f7fa2eac3bce5e4e82a1a97a8c75cdeba2026b760c9df
4
- data.tar.gz: 6c422d15f6e9fcbf6a54b94a3c1873c285728f4d8cc27c0c6a74ce8f55d74242
3
+ metadata.gz: 51ca8549d8d7dc88b44bafa73e5cf4a15b8e804091753289edab08fc1d03acc7
4
+ data.tar.gz: 4098d37c05c2ba2f96c387d398eb49e3502110dfd227614aa51ad6df95fb0d84
5
5
  SHA512:
6
- metadata.gz: 7b9dde032e0c2ea1840fe5b9c5fef3cf7a158bd8946b0215499e0c111889b9330c526213cb69b2c6ca9c7a7877dad12c466a06c411fb17aa17a0f81fd508ea59
7
- data.tar.gz: 8817d7a0e16afe9c9e6a30d03df8692ce21ba8a4ee1216cabba58ef899f35a3ebef3c4fca56600b31bb4d4de912886524dba87920694d025b7c8bfcac9c94596
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 verions values or make use of version information in other useful ways:
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
@@ -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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "versionaire"
5
- spec.version = "15.2.0"
5
+ spec.version = "15.3.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://alchemists.io/projects/versionaire"
data.tar.gz.sig CHANGED
@@ -1,3 +1,4 @@
1
- >�o��"5$�$3��D
2
- :[0v 2l�ơU�����Xx���-��F��EkJ�][[��%Ova&�`B���}�DF����U�Lk��+o ��9���q�qSpr����&{@��b"�+ypiL�aqk �����Z;T��v���%�G�J����",�
3
- �+YzOE��Ժ�T�;ːá��S*AC?��aOٖ�5�\o����P5I?�9w���^\ތ�� m��Ѓ���4z ��q�ۼC�8%���A�:���5t�����~W\K�E�+� �E�.HД;��o* 4a�CU����)�tw,�=;+�|K
1
+ �rB�c��%�f
2
+ 0���m��'���=�ң7��@�?$����l��I�?R�ǿ�+�ֺ#��-���D����2c��;��nkI���Dh��-ÿMvb���OԇA��
3
+ ��E}vuU�*\7]mL-��J$6"!4hBÍueZ~@�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.2.0
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.10
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