dry-types 0.13.0 → 0.13.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 +4 -4
- data/CHANGELOG.md +3 -3
- data/README.md +0 -2
- data/lib/dry/types/compat/form_types.rb +1 -1
- data/lib/dry/types/compat/int.rb +1 -0
- data/lib/dry/types/decorator.rb +6 -1
- data/lib/dry/types/default.rb +8 -1
- data/lib/dry/types/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caa242342e42e0cd3598389c374a373e5937189f9c873dcd922a9d42d280a2d5
|
4
|
+
data.tar.gz: 719d861aa75a9c163d4a12784dc20a9d28fcf156c82e588049b1178959d59aea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a30fdd64b3d6f737f915da9219907d74ddbace66e702ec1f7ea0d40af7bfeee27bc2711d910c8d95933fbeee65644177713b88bf65a915352ff83ecd611785b5
|
7
|
+
data.tar.gz: 3203558d4b9cede5cdaf162637de1bc4453c938d18de5e47286f05fffccfe79be36403799ea2b25f3bbbf107b839931c5f398a9b3d0a91d8b25ab56a2fe40cc3
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# v0.13.0 2018-
|
1
|
+
# v0.13.0 2018-05-03
|
2
2
|
|
3
3
|
## Changed
|
4
4
|
|
@@ -29,7 +29,7 @@
|
|
29
29
|
schema.(name: "Jane", age: nil) # => {name: "Jane", age: nil}
|
30
30
|
```
|
31
31
|
|
32
|
-
Note that by default all keys are required, if a key is expected to absent, add to the corresponding type's meta `omittable: true`:
|
32
|
+
Note that by default all keys are required, if a key is expected to be absent, add to the corresponding type's meta `omittable: true`:
|
33
33
|
|
34
34
|
```ruby
|
35
35
|
intolerant = Types::Hash.schema(name: Types::Strict::String)
|
@@ -59,7 +59,7 @@
|
|
59
59
|
strict_range = Types.Strict(Range)
|
60
60
|
strict_range == Types.Instance(Range) # => true
|
61
61
|
```
|
62
|
-
* `Enum#include?` is an alias to `Enum#
|
62
|
+
* `Enum#include?` is an alias to `Enum#valid?` (d-Pixie + flash-gordon)
|
63
63
|
* `Range` was added (GustavoCaso)
|
64
64
|
* `Array` types filter out `Undefined` values, if you have an array type with a constructor type as its member, the constructor now can return `Dry::Types::Undefined` to indicate empty value:
|
65
65
|
```ruby
|
data/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
[gem]: https://rubygems.org/gems/dry-types
|
2
2
|
[travis]: https://travis-ci.org/dry-rb/dry-types
|
3
|
-
[gemnasium]: https://gemnasium.com/dry-rb/dry-types
|
4
3
|
[codeclimate]: https://codeclimate.com/github/dry-rb/dry-types
|
5
4
|
[coveralls]: https://coveralls.io/r/dry-rb/dry-types
|
6
5
|
[inchpages]: http://inch-ci.org/github/dry-rb/dry-types
|
@@ -9,7 +8,6 @@
|
|
9
8
|
|
10
9
|
[][gem]
|
11
10
|
[][travis]
|
12
|
-
[][gemnasium]
|
13
11
|
[][codeclimate]
|
14
12
|
[][codeclimate]
|
15
13
|
[][inchpages]
|
@@ -5,7 +5,7 @@ Dry::Core::Deprecations.warn('Form types were renamed to Params', tag: :'dry-typ
|
|
5
5
|
module Dry
|
6
6
|
module Types
|
7
7
|
container.keys.grep(/^params\./).each do |key|
|
8
|
-
next if key
|
8
|
+
next if key.start_with?('params.int')
|
9
9
|
register(key.sub('params.', 'form.'), container[key])
|
10
10
|
end
|
11
11
|
|
data/lib/dry/types/compat/int.rb
CHANGED
@@ -9,5 +9,6 @@ module Dry
|
|
9
9
|
register('coercible.int', self['coercible.integer'])
|
10
10
|
register('optional.strict.int', self['optional.strict.integer'])
|
11
11
|
register('optional.coercible.int', self['optional.coercible.integer'])
|
12
|
+
register('params.int', self['params.integer'])
|
12
13
|
end
|
13
14
|
end
|
data/lib/dry/types/decorator.rb
CHANGED
@@ -68,7 +68,7 @@ module Dry
|
|
68
68
|
response = type.__send__(meth, *args, &block)
|
69
69
|
|
70
70
|
if decorate?(response)
|
71
|
-
|
71
|
+
__new__(response)
|
72
72
|
else
|
73
73
|
response
|
74
74
|
end
|
@@ -76,6 +76,11 @@ module Dry
|
|
76
76
|
super
|
77
77
|
end
|
78
78
|
end
|
79
|
+
|
80
|
+
# Replace underlying type
|
81
|
+
def __new__(type)
|
82
|
+
self.class.new(type, options)
|
83
|
+
end
|
79
84
|
end
|
80
85
|
end
|
81
86
|
end
|
data/lib/dry/types/default.rb
CHANGED
@@ -35,7 +35,7 @@ module Dry
|
|
35
35
|
|
36
36
|
# @param [Type] type
|
37
37
|
# @param [Object] value
|
38
|
-
def initialize(type, value,
|
38
|
+
def initialize(type, value, **options)
|
39
39
|
super
|
40
40
|
@value = value
|
41
41
|
end
|
@@ -68,6 +68,13 @@ module Dry
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
alias_method :[], :call
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
# Replace underlying type
|
75
|
+
def __new__(type)
|
76
|
+
self.class.new(type, value, options)
|
77
|
+
end
|
71
78
|
end
|
72
79
|
end
|
73
80
|
end
|
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.13.
|
4
|
+
version: 0.13.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|