versionaire 10.2.2 → 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: 85e681c9b685ee2352246674961efa5bf94c8411c50d1eaf584c2ae7a32979e7
4
- data.tar.gz: ce8ebf5f52cee06ca95ae43e2ea60f665a58e40b6edfcff309e97f2b3eb5c7e7
3
+ metadata.gz: bc07507e3fb5fc47c7c5f5522784b9a12b2088fa6eb91d2e3f3b4a5f0fe68923
4
+ data.tar.gz: 31ad3924066f9040fab56d07a21d69ac87ec8c32d5648c6c64c2ea46ee42cbed
5
5
  SHA512:
6
- metadata.gz: b2bb4e7592e9526ae708c2495150eb5512565248ee4f0e7b36dafea00d7a39365712117e784a125faf9552fff4a2dd55bb10fc18eaa931959be140a60c4b2929
7
- data.tar.gz: 8af895d9aa724847f2c9c2e55063ee52b3299594cdde25fd9b133075ef5f3e97c8bc7076b3eff9992845b58228f7a3518fe78a6f78433a22ceaf396666711e6a
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.2.2"
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"
@@ -13,6 +13,7 @@ Gem::Specification.new do |spec|
13
13
  "bug_tracker_uri" => "https://github.com/bkuhlmann/versionaire/issues",
14
14
  "changelog_uri" => "https://www.alchemists.io/projects/versionaire/versions",
15
15
  "documentation_uri" => "https://www.alchemists.io/projects/versionaire",
16
+ "funding_uri" => "https://github.com/sponsors/bkuhlmann",
16
17
  "label" => "Versionaire",
17
18
  "rubygems_mfa_required" => "true",
18
19
  "source_code_uri" => "https://github.com/bkuhlmann/versionaire"
@@ -22,7 +23,7 @@ Gem::Specification.new do |spec|
22
23
  spec.cert_chain = [Gem.default_cert_path]
23
24
 
24
25
  spec.required_ruby_version = "~> 3.1"
25
- spec.add_dependency "refinements", "~> 9.2"
26
+ spec.add_dependency "refinements", "~> 9.4"
26
27
 
27
28
  spec.files = Dir["*.gemspec", "lib/**/*"]
28
29
  spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
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.2.2
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-04-09 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
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '9.2'
39
+ version: '9.4'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '9.2'
46
+ version: '9.4'
47
47
  description:
48
48
  email:
49
49
  - brooke@alchemists.io
@@ -69,6 +69,7 @@ metadata:
69
69
  bug_tracker_uri: https://github.com/bkuhlmann/versionaire/issues
70
70
  changelog_uri: https://www.alchemists.io/projects/versionaire/versions
71
71
  documentation_uri: https://www.alchemists.io/projects/versionaire
72
+ funding_uri: https://github.com/sponsors/bkuhlmann
72
73
  label: Versionaire
73
74
  rubygems_mfa_required: 'true'
74
75
  source_code_uri: https://github.com/bkuhlmann/versionaire
@@ -87,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
88
  - !ruby/object:Gem::Version
88
89
  version: '0'
89
90
  requirements: []
90
- rubygems_version: 3.3.11
91
+ rubygems_version: 3.3.14
91
92
  signing_key:
92
93
  specification_version: 4
93
94
  summary: Provides an immutable, thread-safe, and semantic version type.
metadata.gz.sig CHANGED
Binary file