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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1776d9481fa83da0c743faa221bda1a9c65634994ef1033e31eaaa4e0cb19633
4
- data.tar.gz: 2167d8631a24e61763400cecb8bf33842f66753a0098a5c3e1610331288d295a
3
+ metadata.gz: 0f0a4896401e4a8c4df94fe4ec19fabe7bbf6dc17b776fa7cd0eabb49de39f84
4
+ data.tar.gz: 4ad3d1ab406e3fa81c68bb2d0a09d0d59c2bb03cde9c0dba6039a38ec16cfae5
5
5
  SHA512:
6
- metadata.gz: 0cacf3c8a5927747a88ca9dd679a1dd685a1aec06ead8d2d0bc349b2534434eda31d6c7d3cb1a42c44a9cca581a1e07c3c9530575d8edffda18094e8699725ae
7
- data.tar.gz: 398494d23393c467d3f18361fc87574d86e2b299fce75b007326b5de45b8a0c3218ff7edb6268ff6b8796da27e84429ac47d602f2743e5bc30c465dc2d4b4705
6
+ metadata.gz: d6a72bbec222e02ce976ec42523e4300611b0c22a59f551cdc9c6ab21af9bf9d591f03a7dce52e3b738862f6f8de98ca2a333543f0ccc49f9489ed887e094d43
7
+ data.tar.gz: acdb7b4f11ac472ff3c555415b9a58732b16dfc43fbfb96cb99ba1ab414fb900ac12fb47f1db6c9a3c8d5ded5a4555b150ab2db11b228939a881d46f1e85e511
@@ -1,3 +1 @@
1
- P0��n4{Zωh����+�F~�����y�� FuNekb��Gh%h�V^�U�����.� �����x7�7 �憡�[q9>\��j��&syRfz����-0pܒX�&AMxF�?����tXX���X��ޔ]vq�Px�~Aɨ%�{��ẓ�H�?���-P�3�:���i�d��h���_�"�L�v)wśEaM�㼩�
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�����aiQͩB5xw��sbhEF��&��a�K���Uci�|�~��ԇs>����{�� (
data.tar.gz.sig CHANGED
Binary file
@@ -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 # "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"
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 # true
78
- version_a == version_b # false
79
- version_a == version_c # true
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 # false
87
- version_a < version_b # true
88
- 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
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 # true
110
- version_a.equal? version_b # false
111
- 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
112
112
  ----
113
113
 
114
114
  === Conversions
115
115
 
116
- ==== Function (Casting)
116
+ ==== Function
117
117
 
118
- The `Versionaire::Version` function is provided for explicit casting to a version:
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:
@@ -8,3 +8,4 @@ require "versionaire/filler"
8
8
  require "versionaire/conversion"
9
9
  require "versionaire/identity"
10
10
  require "versionaire/version"
11
+ 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
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Versionaire
4
+ # Ensures an array can be filled to a certain size with default elements.
4
5
  class Filler
5
6
  def initialize pad = 0, max: 2
6
7
  @pad = pad
@@ -5,7 +5,7 @@ module Versionaire
5
5
  module Identity
6
6
  NAME = "versionaire"
7
7
  LABEL = "Versionaire"
8
- VERSION = "8.4.0"
8
+ VERSION = "8.5.0"
9
9
  VERSION_LABEL = "#{LABEL} #{VERSION}"
10
10
  end
11
11
  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.4.0
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-11-14 00:00:00.000000000 Z
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