versionaire 10.3.0 → 10.4.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: '0597b7aad9daa50218326a759cec0c0267e10b773c553c780367c692cd5b07f6'
4
- data.tar.gz: 535d95aeac1eaa5559ab4afcf75b391a866509e5c0717f6cb6422a59514dad74
3
+ metadata.gz: bc07507e3fb5fc47c7c5f5522784b9a12b2088fa6eb91d2e3f3b4a5f0fe68923
4
+ data.tar.gz: 31ad3924066f9040fab56d07a21d69ac87ec8c32d5648c6c64c2ea46ee42cbed
5
5
  SHA512:
6
- metadata.gz: 315611edb35bfdb8503460e8d398616a59dadec131d1782ceba47014b9788043f8e1555ccc57d8c26ad4f901b89aa91cfbcdeb7f5bfdf75330d300e93de01a5d
7
- data.tar.gz: 045bccc44aa9aa045532587049beb4bdb4aebd3fa83b6b1a529b03c23d3533223d6a1098a26def0a19dfcfeb6e58ea19342ca13d185d14c873ed8b68e89ba10f
6
+ metadata.gz: 26d9c06096b481d81441d7ae00accd2ebcac2140695c14935a58ef69b8a04e73aba6248bd96e88b64d94004dfd85322c839bedae9cf5519370331010f5d5da40
7
+ data.tar.gz: c3d50cd0ffbe8997251e5270cd979199238a306d57120459c7fbbd568f300aee915249663b664cc3a1b9c6472a00bd0e826ea23a3c8cc2c1077591ba6bcdc35e
checksums.yaml.gz.sig CHANGED
Binary file
data/README.adoc CHANGED
@@ -150,7 +150,7 @@ approach to casting like any other primitive.
150
150
 
151
151
  ==== Implicit
152
152
 
153
- Implicit conversion to a `+String+` is supported:
153
+ Implicit conversion to a `String` is supported:
154
154
 
155
155
  [source,ruby]
156
156
  ----
@@ -159,15 +159,39 @@ Implicit conversion to a `+String+` is supported:
159
159
 
160
160
  ==== Explicit
161
161
 
162
- Explicit conversion to a `String`, `Array`, or `Hash` is supported:
162
+ Explicit conversion to a `String`, `Array`, `Hash`, or `Proc` is supported:
163
163
 
164
164
  [source,ruby]
165
165
  ----
166
166
  version = Versionaire::Version.new
167
167
 
168
- version.to_s # "0.0.0"
169
- version.to_a # [0, 0, 0]
170
- version.to_h # {major: 0, minor: 0, patch: 0}
168
+ version.to_s # "0.0.0"
169
+ version.to_a # [0, 0, 0]
170
+ version.to_h # {major: 0, minor: 0, patch: 0}
171
+ version.to_proc # #<Proc:0x000000010b015b88 (lambda)>
172
+ ----
173
+
174
+ To elaborate on procs further, this means the following is possible:
175
+
176
+ [source,ruby]
177
+ ----
178
+ using Versionaire::Cast
179
+
180
+ version = Version "1.2.3"
181
+
182
+ version.to_proc.call :major # 1
183
+ [version, version, version].map(&:minor) # [2, 2, 2]
184
+ ----
185
+
186
+ === Inspections
187
+
188
+ You can inspect a version which is the equivalent of an escaped string representation. Example:
189
+
190
+ [source,ruby]
191
+ ----
192
+ using Versionaire::Cast
193
+
194
+ Version("1.2.3").inspect # "\"1.2.3\""
171
195
  ----
172
196
 
173
197
  === Comparisons
@@ -4,7 +4,7 @@ module Versionaire
4
4
  # Refines Kernel in order to provide a top-level Version conversion function.
5
5
  module Cast
6
6
  refine Kernel do
7
- def Version(object) = Versionaire::Version(object)
7
+ def Version(object) = Versionaire::Version object
8
8
  end
9
9
  end
10
10
  end
@@ -48,10 +48,13 @@ module Versionaire
48
48
 
49
49
  def up(key, value = 1) = revalue(key => value) { |previous, current| previous + current }
50
50
 
51
+ def inspect = to_s.inspect
52
+
53
+ def to_proc = method(:[]).to_proc
54
+
51
55
  def to_s = to_a.join(self.class.delimiter)
52
56
 
53
57
  alias_method :to_str, :to_s
54
- alias_method :values, :to_a
55
58
 
56
59
  private
57
60
 
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 = "10.3.0"
5
+ spec.version = "10.4.0"
6
6
  spec.authors = ["Brooke Kuhlmann"]
7
7
  spec.email = ["brooke@alchemists.io"]
8
8
  spec.homepage = "https://www.alchemists.io/projects/versionaire"
data.tar.gz.sig CHANGED
Binary file
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: 10.3.0
4
+ version: 10.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brooke Kuhlmann
@@ -28,7 +28,7 @@ cert_chain:
28
28
  CxDe2+VuChj4I1nvIHdu+E6XoEVlanUPKmSg6nddhkKn2gC45Kyzh6FZqnzH/CRp
29
29
  RFE=
30
30
  -----END CERTIFICATE-----
31
- date: 2022-05-07 00:00:00.000000000 Z
31
+ date: 2022-05-28 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: refinements
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  requirements: []
91
- rubygems_version: 3.3.13
91
+ rubygems_version: 3.3.14
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: Provides an immutable, thread-safe, and semantic version type.
metadata.gz.sig CHANGED
Binary file