dry-types 0.12.1 → 0.12.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -2
- data/CONTRIBUTING.md +3 -3
- data/Gemfile +1 -1
- data/lib/dry/types/any.rb +1 -0
- data/lib/dry/types/coercions/json.rb +1 -0
- data/lib/dry/types/compiler.rb +1 -2
- data/lib/dry/types/constrained/coercible.rb +3 -4
- data/lib/dry/types/constructor.rb +1 -0
- data/lib/dry/types/decorator.rb +1 -0
- data/lib/dry/types/hash/schema.rb +8 -0
- data/lib/dry/types/spec/types.rb +1 -1
- data/lib/dry/types/sum.rb +1 -0
- data/lib/dry/types/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e6d84eedd9c2c6d676816a1e1284c049ff33312
|
4
|
+
data.tar.gz: ed578364c03b1762bfa45c13b0fa81d70d4a4acd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3895ac984bbc35327603c300f188672910c81906108ea6150163a67dae00281b54198a89bbb71ef0f1abf2b6dc207089c9a3f635c168ba8002d8db99df765143
|
7
|
+
data.tar.gz: b228f7f664b88127c0ed884ea3eb317c0d6f43c0c9692cbae151c2df45273b58768c7c3f42e335a97cc1e85a914d20909ec7d651c90b318aa3a3a78adc92d8dd
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,15 @@
|
|
1
|
-
# v0.12.
|
1
|
+
# v0.12.2 2017-11-04
|
2
|
+
|
3
|
+
## Fixed
|
4
|
+
|
5
|
+
* The type compiler was fixed for simple rules such as used for strict type checks (flash-gordon)
|
6
|
+
* Fixed an error on `Dry::Types['json.decimal'].try(nil)` (nesaulov)
|
7
|
+
* Fixed an error on calling `try` on an array type built of constrained types (flash-gordon)
|
8
|
+
* Implemented `===` for enum types (GustavoCaso)
|
9
|
+
|
10
|
+
[Compare v0.12.1...v0.12.2](https://github.com/dry-rb/dry-types/compare/v0.12.1...v0.12.2)
|
11
|
+
|
12
|
+
# v0.12.1 2017-10-11
|
2
13
|
|
3
14
|
## Fixed
|
4
15
|
|
@@ -7,7 +18,7 @@
|
|
7
18
|
* Optional sum types work correctly in `safe` mode (GustavoCaso)
|
8
19
|
* The equalizer of constrained types respects meta (flash-gordon)
|
9
20
|
|
10
|
-
[Compare v0.12.0...
|
21
|
+
[Compare v0.12.0...v0.12.1](https://github.com/dry-rb/dry-types/compare/v0.12.0...v0.12.1)
|
11
22
|
|
12
23
|
# v0.12.0 2017-09-15
|
13
24
|
|
data/CONTRIBUTING.md
CHANGED
@@ -6,11 +6,11 @@ If you found a bug, report an issue and describe what's the expected behavior ve
|
|
6
6
|
|
7
7
|
## Reporting feature requests
|
8
8
|
|
9
|
-
Report a feature request **only after discussing it first on [
|
9
|
+
Report a feature request **only after discussing it first on [discourse.dry-rb.org](https://discourse.dry-rb.org)** where it was accepted. Please provide a concise description of the feature, don't link to a discussion thread, and instead summarize what was discussed.
|
10
10
|
|
11
11
|
## Reporting questions, support requests, ideas, concerns etc.
|
12
12
|
|
13
|
-
**PLEASE DON'T** - use [
|
13
|
+
**PLEASE DON'T** - use [discourse.dry-rb.org](http://discourse.dry-rb.org) instead.
|
14
14
|
|
15
15
|
# Pull Request Guidelines
|
16
16
|
|
@@ -26,4 +26,4 @@ Other requirements:
|
|
26
26
|
|
27
27
|
# Asking for help
|
28
28
|
|
29
|
-
If these guidelines aren't helpful, and you're stuck, please post a message on [
|
29
|
+
If these guidelines aren't helpful, and you're stuck, please post a message on [discourse.dry-rb.org](https://discourse.dry-rb.org).
|
data/Gemfile
CHANGED
data/lib/dry/types/any.rb
CHANGED
data/lib/dry/types/compiler.rb
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
module Dry
|
2
2
|
module Types
|
3
3
|
class Constrained
|
4
|
-
include Type
|
5
|
-
|
6
4
|
class Coercible < Constrained
|
7
5
|
# @param [Object] input
|
8
6
|
# @param [#call,nil] block
|
9
7
|
# @yieldparam [Failure] failure
|
10
8
|
# @yieldreturn [Result]
|
11
|
-
# @return [Result,
|
9
|
+
# @return [Result,nil]
|
12
10
|
def try(input, &block)
|
13
11
|
result = type.try(input)
|
14
12
|
|
@@ -18,7 +16,8 @@ module Dry
|
|
18
16
|
if validation.success?
|
19
17
|
result
|
20
18
|
else
|
21
|
-
|
19
|
+
failure = failure(result.input, validation)
|
20
|
+
block ? yield(failure) : failure
|
22
21
|
end
|
23
22
|
else
|
24
23
|
block ? yield(result) : result
|
data/lib/dry/types/decorator.rb
CHANGED
data/lib/dry/types/spec/types.rb
CHANGED
@@ -78,7 +78,7 @@ RSpec.shared_examples_for Dry::Types::Definition do
|
|
78
78
|
it 'returns a constructor' do
|
79
79
|
constructor = type.constructor(&:to_s)
|
80
80
|
|
81
|
-
expect(constructor).to
|
81
|
+
expect(constructor).to be_a(Dry::Types::Type)
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
data/lib/dry/types/sum.rb
CHANGED
data/lib/dry/types/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-types
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -274,7 +274,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
274
274
|
version: '0'
|
275
275
|
requirements: []
|
276
276
|
rubyforge_project:
|
277
|
-
rubygems_version: 2.6.
|
277
|
+
rubygems_version: 2.6.13
|
278
278
|
signing_key:
|
279
279
|
specification_version: 4
|
280
280
|
summary: Type system for Ruby supporting coercions, constraints and complex types
|