versionaire 8.4.0 → 8.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -3
- data.tar.gz.sig +0 -0
- data/README.adoc +38 -15
- data/lib/versionaire.rb +1 -0
- data/lib/versionaire/cast.rb +12 -0
- data/lib/versionaire/filler.rb +1 -0
- data/lib/versionaire/identity.rb +1 -1
- metadata +45 -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: 0f0a4896401e4a8c4df94fe4ec19fabe7bbf6dc17b776fa7cd0eabb49de39f84
|
4
|
+
data.tar.gz: 4ad3d1ab406e3fa81c68bb2d0a09d0d59c2bb03cde9c0dba6039a38ec16cfae5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6a72bbec222e02ce976ec42523e4300611b0c22a59f551cdc9c6ab21af9bf9d591f03a7dce52e3b738862f6f8de98ca2a333543f0ccc49f9489ed887e094d43
|
7
|
+
data.tar.gz: acdb7b4f11ac472ff3c555415b9a58732b16dfc43fbfb96cb99ba1ab414fb900ac12fb47f1db6c9a3c8d5ded5a4555b150ab2db11b228939a881d46f1e85e511
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1 @@
|
|
1
|
-
|
2
|
-
K:�$�LyԄ�h�]h���W��[Y
|
3
|
-
dq�
|
1
|
+
K�P�Ap_��J~_�X#�l��&�s�P�>'VɃT��A,�51���G���'�%�K~����}�/ �'5:�\#�`S,��S<Ԣ���VӋ.,��з) (�M�0%���>�浝�%�p6^�W=[I���<��;e���P��Y���5t=2<*����3ZK�ג��/{�E��B�ڦ5r�����a�i�QͩB�5�x�w��sb�hEF��&��a�K���Uc�i�|�~��ԇs>����{�� (
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.adoc
CHANGED
@@ -55,10 +55,10 @@ A new version can be initialized in a variety of ways:
|
|
55
55
|
|
56
56
|
[source,ruby]
|
57
57
|
----
|
58
|
-
Versionaire::Version.new
|
59
|
-
Versionaire::Version[major: 1]
|
60
|
-
Versionaire::Version[major: 1, minor: 2]
|
61
|
-
Versionaire::Version[major: 1, minor: 2, patch: 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"
|
62
62
|
----
|
63
63
|
|
64
64
|
=== Equality
|
@@ -74,18 +74,18 @@ version_a = Versionaire::Version[major: 1]
|
|
74
74
|
version_b = Versionaire::Version[major: 2]
|
75
75
|
version_c = Versionaire::Version[major: 1]
|
76
76
|
|
77
|
-
version_a == version_a
|
78
|
-
version_a == version_b
|
79
|
-
version_a == version_c
|
77
|
+
version_a == version_a # true
|
78
|
+
version_a == version_b # false
|
79
|
+
version_a == version_c # true
|
80
80
|
----
|
81
81
|
|
82
82
|
Knowning this, versions can be compared against one another too:
|
83
83
|
|
84
84
|
[source,ruby]
|
85
85
|
----
|
86
|
-
version_a > version_b
|
87
|
-
version_a < version_b
|
88
|
-
version_a.between? version_c, version_b
|
86
|
+
version_a > version_b # false
|
87
|
+
version_a < version_b # true
|
88
|
+
version_a.between? version_c, version_b # true
|
89
89
|
----
|
90
90
|
|
91
91
|
==== Hash (`#eql?`)
|
@@ -106,16 +106,16 @@ version_a = Versionaire::Version[major: 1]
|
|
106
106
|
version_b = Versionaire::Version[major: 2]
|
107
107
|
version_c = Versionaire::Version[major: 1]
|
108
108
|
|
109
|
-
version_a.equal? version_a
|
110
|
-
version_a.equal? version_b
|
111
|
-
version_a.equal? version_c
|
109
|
+
version_a.equal? version_a # true
|
110
|
+
version_a.equal? version_b # false
|
111
|
+
version_a.equal? version_c # false
|
112
112
|
----
|
113
113
|
|
114
114
|
=== Conversions
|
115
115
|
|
116
|
-
==== Function
|
116
|
+
==== Function
|
117
117
|
|
118
|
-
|
118
|
+
Use the `Versionaire::Version` function to explicitly cast to a version:
|
119
119
|
|
120
120
|
[source,ruby]
|
121
121
|
----
|
@@ -130,6 +130,29 @@ Versionaire::Version version
|
|
130
130
|
Each of these conversions will result in a version object that represents "`1.0.0`". When attempting
|
131
131
|
to convert an unsupported type, a `+Versionaire::Errors::Conversion+` exception will be thrown.
|
132
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.
|
155
|
+
|
133
156
|
==== Implicit
|
134
157
|
|
135
158
|
Implicit conversion to a `+String+` is supported:
|
data/lib/versionaire.rb
CHANGED
data/lib/versionaire/filler.rb
CHANGED
data/lib/versionaire/identity.rb
CHANGED
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.
|
4
|
+
version: 8.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brooke Kuhlmann
|
@@ -28,7 +28,7 @@ cert_chain:
|
|
28
28
|
2XV8FRa7/JimI07sPLC13eLY3xd/aYTi85Z782KIA4j0G8XEEWAX0ouBhlXPocZv
|
29
29
|
QWc=
|
30
30
|
-----END CERTIFICATE-----
|
31
|
-
date: 2020-
|
31
|
+
date: 2020-12-04 00:00:00.000000000 Z
|
32
32
|
dependencies:
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: bundler-audit
|
@@ -58,6 +58,34 @@ dependencies:
|
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '0.2'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: gemsmith
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '14.8'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '14.8'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: git-lint
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '1.3'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.3'
|
61
89
|
- !ruby/object:Gem::Dependency
|
62
90
|
name: guard-rspec
|
63
91
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,6 +156,20 @@ dependencies:
|
|
128
156
|
- - "~>"
|
129
157
|
- !ruby/object:Gem::Version
|
130
158
|
version: '6.0'
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: refinements
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - "~>"
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '7.16'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - "~>"
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '7.16'
|
131
173
|
- !ruby/object:Gem::Dependency
|
132
174
|
name: rspec
|
133
175
|
requirement: !ruby/object:Gem::Requirement
|
@@ -224,6 +266,7 @@ files:
|
|
224
266
|
- LICENSE.adoc
|
225
267
|
- README.adoc
|
226
268
|
- lib/versionaire.rb
|
269
|
+
- lib/versionaire/cast.rb
|
227
270
|
- lib/versionaire/conversion.rb
|
228
271
|
- lib/versionaire/errors/base.rb
|
229
272
|
- lib/versionaire/errors/conversion.rb
|
metadata.gz.sig
CHANGED
Binary file
|