kind 5.4.1 → 5.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: 4b29ece70180bb5064e2d1c598ce81d09dabfe11492a14e4f97efe4f47154565
4
- data.tar.gz: 927a414846defd4e53430fbb6d5a36b26dbc51b1de6bb81b8bb797f266dca8c8
3
+ metadata.gz: 9e91ad1bc49fe0ca0e32f62bf55da4c6fa6aa8a54372aeeda0894cc76ac93c18
4
+ data.tar.gz: 241a52a87f1492c6b952687e3105f3b95c90f3ac30c2810da3911414737861cd
5
5
  SHA512:
6
- metadata.gz: '018246a93c971ba79591b6a6f6e18417d5c67f8574865a38fa617782ce2419a3941851303b99a90ad31ab5e4362a0465c8b13222096cc17521693a775248b8ae'
7
- data.tar.gz: dcd4c0ac25fe19b63039d92cd40d006b133cbc662b662933b5ec6b3d95b3fcbbd5767f842a2402a1e28e4f2c831a3c058aa69cac7614964a03df0da2d8a9ba3f
6
+ metadata.gz: 7b2ba35383908bac2542bb93afabb2cc0385a06556a184101dd7da21983bb55ee548ab539f609e8604dcbceecdea6d6b67f26dd8323f1404dee5eca308951bcb
7
+ data.tar.gz: 9500bf6cc0484ae417ddea388ca670a4f615931c32ca24f82ae6798ac57bae9e9e80e663aca9c19d837a1f82529c2127a96effc546d13b175fdb3f12456854fe
data/CHANGELOG.md CHANGED
@@ -3,79 +3,81 @@
3
3
  This project follows [semver 2.0.0](http://semver.org/spec/v2.0.0.html) and the recommendations of [keepachangelog.com](http://keepachangelog.com/).
4
4
 
5
5
  - [Unreleased](#unreleased)
6
+ - [5.5.0 (2021-04-05)](#550-2021-04-05)
7
+ - [Added](#added)
6
8
  - [5.4.1 (2021-03-26)](#541-2021-03-26)
7
9
  - [Fixed](#fixed)
8
10
  - [5.4.0 (2021-03-25)](#540-2021-03-25)
9
- - [Added](#added)
10
- - [5.3.0 (2021-03-23)](#530-2021-03-23)
11
11
  - [Added](#added-1)
12
- - [5.2.0 (2021-03-17)](#520-2021-03-17)
12
+ - [5.3.0 (2021-03-23)](#530-2021-03-23)
13
13
  - [Added](#added-2)
14
+ - [5.2.0 (2021-03-17)](#520-2021-03-17)
15
+ - [Added](#added-3)
14
16
  - [Deprecated](#deprecated)
15
17
  - [Changes](#changes)
16
18
  - [5.1.0 (2021-02-23)](#510-2021-02-23)
17
- - [Added](#added-3)
19
+ - [Added](#added-4)
18
20
  - [Deprecated](#deprecated-1)
19
21
  - [5.0.0 (2021-02-22)](#500-2021-02-22)
20
22
  - [Breaking Changes](#breaking-changes)
21
23
  - [Removed](#removed)
22
24
  - [4.1.0 (2021-02-22)](#410-2021-02-22)
23
- - [Added](#added-4)
24
- - [4.0.0 (2021-02-22)](#400-2021-02-22)
25
25
  - [Added](#added-5)
26
+ - [4.0.0 (2021-02-22)](#400-2021-02-22)
27
+ - [Added](#added-6)
26
28
  - [Deprecated](#deprecated-2)
27
29
  - [Fixed](#fixed-1)
28
30
  - [3.1.0 (2020-07-08)](#310-2020-07-08)
29
- - [Added](#added-6)
31
+ - [Added](#added-7)
30
32
  - [3.0.0 (2020-06-25)](#300-2020-06-25)
31
33
  - [Breaking Changes](#breaking-changes-1)
32
- - [Added](#added-7)
33
- - [2.3.0 (2020-06-24)](#230-2020-06-24)
34
34
  - [Added](#added-8)
35
- - [2.2.0 (2020-06-23)](#220-2020-06-23)
35
+ - [2.3.0 (2020-06-24)](#230-2020-06-24)
36
36
  - [Added](#added-9)
37
- - [2.1.0 (2020-05-12)](#210-2020-05-12)
37
+ - [2.2.0 (2020-06-23)](#220-2020-06-23)
38
38
  - [Added](#added-10)
39
+ - [2.1.0 (2020-05-12)](#210-2020-05-12)
40
+ - [Added](#added-11)
39
41
  - [Breaking Changes](#breaking-changes-2)
40
42
  - [2.0.0 (2020-05-07)](#200-2020-05-07)
41
- - [Added](#added-11)
43
+ - [Added](#added-12)
42
44
  - [Breaking Changes](#breaking-changes-3)
43
45
  - [Removed](#removed-1)
44
46
  - [1.9.0 (2020-05-06)](#190-2020-05-06)
45
- - [Added](#added-12)
46
- - [1.8.0 (2020-05-03)](#180-2020-05-03)
47
47
  - [Added](#added-13)
48
+ - [1.8.0 (2020-05-03)](#180-2020-05-03)
49
+ - [Added](#added-14)
48
50
  - [1.7.0 (2020-05-03)](#170-2020-05-03)
49
51
  - [Fixed](#fixed-2)
50
52
  - [1.6.0 (2020-04-17)](#160-2020-04-17)
51
- - [Added](#added-14)
53
+ - [Added](#added-15)
52
54
  - [Changes](#changes-1)
53
55
  - [1.5.0 (2020-04-12)](#150-2020-04-12)
54
- - [Added](#added-15)
55
- - [1.4.0 (2020-04-12)](#140-2020-04-12)
56
56
  - [Added](#added-16)
57
- - [1.3.0 (2020-04-12)](#130-2020-04-12)
57
+ - [1.4.0 (2020-04-12)](#140-2020-04-12)
58
58
  - [Added](#added-17)
59
- - [1.2.0 (2020-04-12)](#120-2020-04-12)
59
+ - [1.3.0 (2020-04-12)](#130-2020-04-12)
60
60
  - [Added](#added-18)
61
- - [1.1.0 (2020-04-09)](#110-2020-04-09)
61
+ - [1.2.0 (2020-04-12)](#120-2020-04-12)
62
62
  - [Added](#added-19)
63
+ - [1.1.0 (2020-04-09)](#110-2020-04-09)
64
+ - [Added](#added-20)
63
65
  - [Fixed](#fixed-3)
64
66
  - [1.0.0 (2020-03-16)](#100-2020-03-16)
65
- - [Added](#added-20)
66
- - [0.6.0 (2020-01-06)](#060-2020-01-06)
67
67
  - [Added](#added-21)
68
- - [0.5.0 (2020-01-04)](#050-2020-01-04)
68
+ - [0.6.0 (2020-01-06)](#060-2020-01-06)
69
69
  - [Added](#added-22)
70
- - [0.4.0 (2020-01-03)](#040-2020-01-03)
70
+ - [0.5.0 (2020-01-04)](#050-2020-01-04)
71
71
  - [Added](#added-23)
72
- - [0.3.0 (2020-01-03)](#030-2020-01-03)
72
+ - [0.4.0 (2020-01-03)](#040-2020-01-03)
73
73
  - [Added](#added-24)
74
+ - [0.3.0 (2020-01-03)](#030-2020-01-03)
75
+ - [Added](#added-25)
74
76
  - [Breaking Changes](#breaking-changes-4)
75
77
  - [0.2.0 (2020-01-02)](#020-2020-01-02)
76
- - [Added](#added-25)
77
- - [0.1.0 (2019-12-26)](#010-2019-12-26)
78
78
  - [Added](#added-26)
79
+ - [0.1.0 (2019-12-26)](#010-2019-12-26)
80
+ - [Added](#added-27)
79
81
 
80
82
  ## Unreleased
81
83
 
@@ -87,6 +89,29 @@ This project follows [semver 2.0.0](http://semver.org/spec/v2.0.0.html) and the
87
89
  ### Fixed
88
90
  -->
89
91
 
92
+ 5.5.0 (2021-04-05)
93
+ ------------------
94
+
95
+ ### Added
96
+
97
+ * [#56](https://github.com/serradura/kind/pull/56) - Add `Kind.or_nil()`.
98
+ ```ruby
99
+ Kind.or_nil(String, 1) # nil
100
+
101
+ Kind.or_nil(String, '') # ""
102
+
103
+ # --
104
+
105
+ filled_string = ->(value) { value.is_a?(String) && !value.empty? }
106
+
107
+ Kind.or_nil(filled_string, 1) # nil
108
+ Kind.or_nil(filled_string, '') # nil
109
+
110
+ Kind.or_nil(filled_string, '1') # "1"
111
+ ```
112
+
113
+ [⬆️  Back to Top](#changelog-)
114
+
90
115
  5.4.1 (2021-03-26)
91
116
  ------------------
92
117
 
data/README.md CHANGED
@@ -42,7 +42,7 @@ So, I invite you to check out these features to see how they could be useful for
42
42
  Version | Documentation
43
43
  ---------- | -------------
44
44
  unreleased | https://github.com/serradura/kind/blob/main/README.md
45
- 5.4.1 | https://github.com/serradura/kind/blob/v5.x/README.md
45
+ 5.5.0 | https://github.com/serradura/kind/blob/v5.x/README.md
46
46
  4.1.0 | https://github.com/serradura/kind/blob/v4.x/README.md
47
47
  3.1.0 | https://github.com/serradura/kind/blob/v3.x/README.md
48
48
  2.3.0 | https://github.com/serradura/kind/blob/v2.x/README.md
@@ -125,7 +125,7 @@ unreleased | https://github.com/serradura/kind/blob/main/README.md
125
125
  | kind | branch | ruby | activemodel |
126
126
  | -------------- | ------- | ------------------ | -------------- |
127
127
  | unreleased | main | >= 2.1.0, <= 3.0.0 | >= 3.2, < 7.0 |
128
- | 5.4.1 | v5.x | >= 2.1.0, <= 3.0.0 | >= 3.2, < 7.0 |
128
+ | 5.5.0 | v5.x | >= 2.1.0, <= 3.0.0 | >= 3.2, < 7.0 |
129
129
  | 4.1.0 | v4.x | >= 2.2.0, <= 3.0.0 | >= 3.2, < 7.0 |
130
130
  | 3.1.0 | v3.x | >= 2.2.0, <= 2.7 | >= 3.2, < 7.0 |
131
131
  | 2.3.0 | v2.x | >= 2.2.0, <= 2.7 | >= 3.2, <= 6.0 |
data/lib/kind/basic.rb CHANGED
@@ -76,4 +76,8 @@ module Kind
76
76
  def value(kind, value, default:)
77
77
  KIND.value(kind, value, of(kind, default))
78
78
  end
79
+
80
+ def or_nil(kind, value)
81
+ return value if kind === value
82
+ end
79
83
  end
data/lib/kind/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kind
4
- VERSION = '5.4.1'
4
+ VERSION = '5.5.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kind
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.4.1
4
+ version: 5.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Serradura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-26 00:00:00.000000000 Z
11
+ date: 2021-04-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A development toolkit for Ruby with several small/cohesive abstractions
14
14
  (monads, enums, business logic, data validation...) to empower your development