dry-logic 1.0.4 → 1.0.5

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: 7a7700d85d1b92e3f0ddb2625b7c01e420101b33ae39ee12d1dcc342d22471d0
4
- data.tar.gz: 5324d7fa8ef310acdfe0de371ab7c7ac28fee9454a8a339a5cfad3170fc1527e
3
+ metadata.gz: 2eaa5ac48636ac8735eb5acfd455b0a6cc23887730500a3738a0e6b79b105187
4
+ data.tar.gz: 98d6ba8d611d80f4a1eb0ef3aa52dfcf976ef46ceabe92040f9090caaa98a4cb
5
5
  SHA512:
6
- metadata.gz: 89917d5c3c0b0d2f988db144b66d898606a8a2aae27f92c681bdb99646601236e63a08bce58a07bf6e50bad27c3458b89c3a3aaa73745266c83fe6008852da02
7
- data.tar.gz: 7d3635146104a74a58f60ee2b819ae61a568fd936b3abe0a93eeb3e908b7658c0613bdcda9c5cbb423d2434039ccdcdc221fd316ea6dec15029396d2888e3d5b
6
+ metadata.gz: 9de80f29b7ee5b3d8303a6834a94f20442ac3c78d9c90b634c91a7d6d7e620a5c96eea6d7142fbe361561d5076261f8ec54d0cfd6ebbdd05926a4b59d77b1919
7
+ data.tar.gz: 56ed2dc66cd66fd80d7437c5f75adee53dcfbb8e721b1d83a87d1e6fca35fab3dd8bb04f7cdb00c35c64d70f8d0685bed2900b2835bc7f710cacda8e034aa0f0
@@ -1,3 +1,9 @@
1
+ # v1.0.5 2019-11-07
2
+
3
+ - Make `format?` tolerant to `nil` values. It already worked like that before, but starting Ruby 2.7 it would produce warnings. Now it won't. Don't rely on this behavior, it's only added to make tests pass in dry-schema. Use explicit type checks instead (@flash-gordon)
4
+
5
+ [Compare v1.0.4...v1.0.5](https://github.com/dry-rb/dry-logic/compare/v1.0.4...v1.0.5)
6
+
1
7
  # v1.0.4 2019-11-06
2
8
 
3
9
  - Fix keyword warnings (@flash-gordon)
@@ -199,7 +199,7 @@ module Dry
199
199
  end
200
200
 
201
201
  def format?(regex, input)
202
- regex.match?(input)
202
+ !input.nil? && regex.match?(input)
203
203
  end
204
204
 
205
205
  def case?(pattern, input)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Logic
5
- VERSION = '1.0.4'
5
+ VERSION = '1.0.5'
6
6
  end
7
7
  end
@@ -7,7 +7,7 @@ RSpec.describe Dry::Logic::Predicates, '#format?' do
7
7
 
8
8
  context 'when value matches provided regexp' do
9
9
  let(:arguments_list) do
10
- [['Foo', /^F/]]
10
+ [[/^F/, 'Foo']]
11
11
  end
12
12
 
13
13
  it_behaves_like 'a passing predicate'
@@ -15,7 +15,15 @@ RSpec.describe Dry::Logic::Predicates, '#format?' do
15
15
 
16
16
  context 'when value does not match provided regexp' do
17
17
  let(:arguments_list) do
18
- [['Bar', /^F/]]
18
+ [[/^F/, 'Bar']]
19
+ end
20
+
21
+ it_behaves_like 'a failing predicate'
22
+ end
23
+
24
+ context 'when input is nil' do
25
+ let(:arguments_list) do
26
+ [[/^F/, nil]]
19
27
  end
20
28
 
21
29
  it_behaves_like 'a failing predicate'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-logic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica