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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a75136625920c87b6bc3a3086ce8e057b281e26dbde7ad783f00e905e68d4209
4
- data.tar.gz: fb425d0891a89dd65f05527664edcaca3511a51627cc84f9872c2b01e3ffa585
3
+ metadata.gz: caa242342e42e0cd3598389c374a373e5937189f9c873dcd922a9d42d280a2d5
4
+ data.tar.gz: 719d861aa75a9c163d4a12784dc20a9d28fcf156c82e588049b1178959d59aea
5
5
  SHA512:
6
- metadata.gz: 893b870ed93db86a97184ff07873df4d58e3379b3a561e6f3962c2aa656c52e4cbe856d9f5f401da0d85da86b5a78880e1173a8c78fcbf4ff2c86b70417a9313
7
- data.tar.gz: 05db55e6352c55dc2a8357f4062f0bef409babe4a7702ab1e8a6c4d3a1d12e90a7be7b0865bf197ce6ede56abeb0c59b22a580428b6cf10ade5148ee3c763a81
6
+ metadata.gz: a30fdd64b3d6f737f915da9219907d74ddbace66e702ec1f7ea0d40af7bfeee27bc2711d910c8d95933fbeee65644177713b88bf65a915352ff83ecd611785b5
7
+ data.tar.gz: 3203558d4b9cede5cdaf162637de1bc4453c938d18de5e47286f05fffccfe79be36403799ea2b25f3bbbf107b839931c5f398a9b3d0a91d8b25ab56a2fe40cc3
@@ -1,4 +1,4 @@
1
- # v0.13.0 2018-03-03
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#valud?` (d-Pixie + flash-gordon)
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 Version](https://badge.fury.io/rb/dry-types.svg)][gem]
11
10
  [![Build Status](https://travis-ci.org/dry-rb/dry-types.svg?branch=master)][travis]
12
- [![Dependency Status](https://gemnasium.com/dry-rb/dry-types.svg)][gemnasium]
13
11
  [![Code Climate](https://codeclimate.com/github/dry-rb/dry-types/badges/gpa.svg)][codeclimate]
14
12
  [![Test Coverage](https://codeclimate.com/github/dry-rb/dry-types/badges/coverage.svg)][codeclimate]
15
13
  [![Inline docs](http://inch-ci.org/github/dry-rb/dry-types.svg?branch=master)][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 == 'params.integer'
8
+ next if key.start_with?('params.int')
9
9
  register(key.sub('params.', 'form.'), container[key])
10
10
  end
11
11
 
@@ -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
@@ -68,7 +68,7 @@ module Dry
68
68
  response = type.__send__(meth, *args, &block)
69
69
 
70
70
  if decorate?(response)
71
- self.class.new(response, options)
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
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module Types
3
- VERSION = '0.13.0'.freeze
3
+ VERSION = '0.13.1'.freeze
4
4
  end
5
5
  end
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.0
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-03 00:00:00.000000000 Z
11
+ date: 2018-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby