dry-validation 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63194a473d9c41ac3d26a861eeb4b83bee43196864439646cdb62fca01c6ac68
4
- data.tar.gz: da3ec5f48cc07869828c9c692259e36fe199801a4c7573abaee67a3340928347
3
+ metadata.gz: 7da2738360b969decba415a2a6418b41ca8b55202d39dd6843871722b904164e
4
+ data.tar.gz: 20cfc387c6ebe8ce8ffd9b6d9227d59393cf304ba70bdd01ace0ff13d67e99fe
5
5
  SHA512:
6
- metadata.gz: 5f523435436ea0c17789d40a2dba7fef627cab4dfcd2f1f2955c2a0b8f2a9a98d144e0ea3e821d07830bd100857fb20d18d9e6c6225e361193e4b0d6579613de
7
- data.tar.gz: 93a13f949010dc5bbd47e1608ba43dcb6d18cea091c3ec8b5706e5d80bae4b6beecfc57312db83ec1dd1f3a8a9f26fa3c8b290307e7ba331f09c5d555d66c78d
6
+ metadata.gz: 5d86de3a87c58f51dabd171950a3d72398e3a93fde3ac521937c0e7b13518388519238127968eb330b991774a2d017b109e3ddc919e23d423771c2bee6361a63
7
+ data.tar.gz: 86c6cc8cf5ea0ba31dda616f68cedd2481f9e1f8455d787d4575583af7ad7428cee4de45477bf454084adacd6778216f2867dc95ac0cbe1e9fad2889a07f124a
@@ -1,3 +1,17 @@
1
+ # v1.4.1 2020-01-08
2
+
3
+ ### Added
4
+
5
+ - Pattern matching on result values (@flash-gordon)
6
+
7
+ ### Fixed
8
+
9
+ - List tokens are correctly interpolated as a comma separated list in rule messages (see #611) (@waiting-for-dev)
10
+ - Warnings about delegated keywords (@flash-gordon)
11
+ - A few delegation warnings about keyword arguments (@flash-gordon)
12
+
13
+ [Compare v1.4.0...v1.4.1](https://github.com/dry-rb/dry-validation/compare/v1.4.0...v1.4.1)
14
+
1
15
  # v1.4.0 2019-12-12
2
16
 
3
17
  ### Added
@@ -16,7 +30,7 @@
16
30
  - [internal] improved performance in `Contract.ensure_valid_keys` (@grzegorz-jakubiak)
17
31
  - [internal] fixed keyword warnings on MRI 2.7.0 (@flash-gordon)
18
32
 
19
- [Compare v1.3.1...master](https://github.com/dry-rb/dry-validation/compare/v1.3.1...master)
33
+ [Compare v1.3.1...v1.4.0](https://github.com/dry-rb/dry-validation/compare/v1.3.1...v1.4.0)
20
34
 
21
35
  # v1.3.1 2019-08-16
22
36
 
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2019 dry-rb team
3
+ Copyright (c) 2015-2020 dry-rb team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -1,29 +1,28 @@
1
1
  [gem]: https://rubygems.org/gems/dry-validation
2
- [ci]: https://github.com/dry-rb/dry-validation/actions?query=workflow%3Aci
3
- [codeclimate]: https://codeclimate.com/github/dry-rb/dry-validation
2
+ [actions]: https://github.com/dry-rb/dry-validation/actions
3
+ [codacy]: https://www.codacy.com/gh/dry-rb/dry-validation
4
4
  [chat]: https://dry-rb.zulipchat.com
5
5
  [inchpages]: http://inch-ci.org/github/dry-rb/dry-validation
6
6
 
7
7
  # dry-validation [![Join the chat at https://dry-rb.zulipchat.com](https://img.shields.io/badge/dry--rb-join%20chat-%23346b7a.svg)][chat]
8
8
 
9
9
  [![Gem Version](https://badge.fury.io/rb/dry-validation.svg)][gem]
10
- [![Build Status](https://github.com/dry-rb/dry-monads/workflows/ci/badge.svg)][ci]
11
- [![Code Climate](https://codeclimate.com/github/dry-rb/dry-validation/badges/gpa.svg)][codeclimate]
12
- [![Test Coverage](https://codeclimate.com/github/dry-rb/dry-validation/badges/coverage.svg)][codeclimate]
10
+ [![CI Status](https://github.com/dry-rb/dry-validation/workflows/ci/badge.svg)][actions]
11
+ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/f30e3ff5ec304c55a73868cdbf055c67)][codacy]
12
+ [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/f30e3ff5ec304c55a73868cdbf055c67)][codacy]
13
13
  [![Inline docs](http://inch-ci.org/github/dry-rb/dry-validation.svg?branch=master)][inchpages]
14
14
 
15
15
  ## Links
16
16
 
17
- - [User documentation](https://dry-rb.org/gems/dry-validation)
18
- - [API documentation](http://rubydoc.info/gems/dry-validation)
19
- - [Guidelines for contributing](CONTRIBUTING.md)
17
+ * [User documentation](http://dry-rb.org/gems/dry-validation)
18
+ * [API documentation](http://rubydoc.info/gems/dry-validation)
20
19
 
21
20
  ## Supported Ruby versions
22
21
 
23
22
  This library officially supports the following Ruby versions:
24
23
 
25
- - MRI >= `2.4`
26
- - jruby >= `9.2`
24
+ * MRI >= `2.4`
25
+ * jruby >= `9.2`
27
26
 
28
27
  ## License
29
28
 
@@ -192,6 +192,7 @@ module Dry
192
192
  super
193
193
  end
194
194
  end
195
+ ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
195
196
  end
196
197
  end
197
198
  end
@@ -12,7 +12,7 @@ module Dry
12
12
  #
13
13
  # @see Dry::Validation::Contract
14
14
  WHITELIST = %i[
15
- filled? gt? gteq? included_in? includes? inclusion? is? lt?
15
+ filled? format? gt? gteq? included_in? includes? inclusion? is? lt?
16
16
  lteq? max_size? min_size? not_eql? odd? respond_to? size? true?
17
17
  uuid_v4?
18
18
  ].freeze
@@ -75,11 +75,31 @@ module Dry
75
75
  STR
76
76
  end
77
77
 
78
- text = template.(template.data(tokens))
78
+ parsed_tokens = parse_tokens(tokens)
79
+ text = template.(template.data(parsed_tokens))
79
80
 
80
81
  [full ? "#{messages.rule(keys.last, msg_opts)} #{text}" : text, meta]
81
82
  end
82
83
  # rubocop:enable Metrics/AbcSize
84
+
85
+ private
86
+
87
+ def parse_tokens(tokens)
88
+ Hash[
89
+ tokens.map do |key, token|
90
+ [key, parse_token(token)]
91
+ end
92
+ ]
93
+ end
94
+
95
+ def parse_token(token)
96
+ case token
97
+ when Array
98
+ token.join(', ')
99
+ else
100
+ token
101
+ end
102
+ end
83
103
  end
84
104
  end
85
105
  end
@@ -179,6 +179,22 @@ module Dry
179
179
  super
180
180
  end
181
181
 
182
+ if RUBY_VERSION >= '2.7'
183
+ # Pattern matching
184
+ #
185
+ # @api private
186
+ def deconstruct_keys(keys)
187
+ values.deconstruct_keys(keys)
188
+ end
189
+
190
+ # Pattern matching
191
+ #
192
+ # @api private
193
+ def deconstruct
194
+ [values, context.each.to_h]
195
+ end
196
+ end
197
+
182
198
  private
183
199
 
184
200
  # @api private
@@ -89,6 +89,7 @@ module Dry
89
89
  super
90
90
  end
91
91
  end
92
+ ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
92
93
  end
93
94
  end
94
95
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Validation
5
- VERSION = '1.4.0'
5
+ VERSION = '1.4.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-validation
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-12 00:00:00.000000000 Z
11
+ date: 2020-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -95,7 +95,7 @@ dependencies:
95
95
  version: '1.0'
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
- version: 1.3.1
98
+ version: 1.4.3
99
99
  type: :runtime
100
100
  prerelease: false
101
101
  version_requirements: !ruby/object:Gem::Requirement
@@ -105,7 +105,7 @@ dependencies:
105
105
  version: '1.0'
106
106
  - - ">="
107
107
  - !ruby/object:Gem::Version
108
- version: 1.3.1
108
+ version: 1.4.3
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: bundler
111
111
  requirement: !ruby/object:Gem::Requirement
@@ -200,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
200
  - !ruby/object:Gem::Version
201
201
  version: '0'
202
202
  requirements: []
203
- rubygems_version: 3.0.3
203
+ rubygems_version: 3.1.2
204
204
  signing_key:
205
205
  specification_version: 4
206
206
  summary: Validation library