dry-types 0.15.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md +10 -0
  3. data/.github/ISSUE_TEMPLATE/---bug-report.md +34 -0
  4. data/.github/ISSUE_TEMPLATE/---feature-request.md +18 -0
  5. data/.gitignore +1 -0
  6. data/.rubocop.yml +18 -2
  7. data/.travis.yml +10 -5
  8. data/.yardopts +6 -2
  9. data/CHANGELOG.md +186 -3
  10. data/Gemfile +11 -5
  11. data/README.md +4 -3
  12. data/Rakefile +4 -2
  13. data/benchmarks/hash_schemas.rb +10 -6
  14. data/benchmarks/lax_schema.rb +15 -0
  15. data/benchmarks/profile_invalid_input.rb +15 -0
  16. data/benchmarks/profile_lax_schema_valid.rb +16 -0
  17. data/benchmarks/profile_valid_input.rb +15 -0
  18. data/benchmarks/schema_valid_vs_invalid.rb +21 -0
  19. data/benchmarks/setup.rb +17 -0
  20. data/docsite/source/array-with-member.html.md +13 -0
  21. data/docsite/source/built-in-types.html.md +116 -0
  22. data/docsite/source/constraints.html.md +31 -0
  23. data/docsite/source/custom-types.html.md +93 -0
  24. data/docsite/source/default-values.html.md +91 -0
  25. data/docsite/source/enum.html.md +69 -0
  26. data/docsite/source/getting-started.html.md +57 -0
  27. data/docsite/source/hash-schemas.html.md +169 -0
  28. data/docsite/source/index.html.md +155 -0
  29. data/docsite/source/map.html.md +17 -0
  30. data/docsite/source/optional-values.html.md +96 -0
  31. data/docsite/source/sum.html.md +21 -0
  32. data/dry-types.gemspec +21 -19
  33. data/lib/dry-types.rb +2 -0
  34. data/lib/dry/types.rb +60 -17
  35. data/lib/dry/types/any.rb +21 -10
  36. data/lib/dry/types/array.rb +17 -1
  37. data/lib/dry/types/array/constructor.rb +32 -0
  38. data/lib/dry/types/array/member.rb +72 -13
  39. data/lib/dry/types/builder.rb +49 -5
  40. data/lib/dry/types/builder_methods.rb +43 -16
  41. data/lib/dry/types/coercions.rb +84 -19
  42. data/lib/dry/types/coercions/json.rb +22 -3
  43. data/lib/dry/types/coercions/params.rb +98 -30
  44. data/lib/dry/types/compiler.rb +35 -12
  45. data/lib/dry/types/constrained.rb +78 -27
  46. data/lib/dry/types/constrained/coercible.rb +36 -6
  47. data/lib/dry/types/constraints.rb +15 -1
  48. data/lib/dry/types/constructor.rb +77 -62
  49. data/lib/dry/types/constructor/function.rb +200 -0
  50. data/lib/dry/types/container.rb +5 -0
  51. data/lib/dry/types/core.rb +35 -14
  52. data/lib/dry/types/decorator.rb +37 -10
  53. data/lib/dry/types/default.rb +48 -16
  54. data/lib/dry/types/enum.rb +31 -16
  55. data/lib/dry/types/errors.rb +73 -7
  56. data/lib/dry/types/extensions.rb +6 -0
  57. data/lib/dry/types/extensions/maybe.rb +52 -5
  58. data/lib/dry/types/extensions/monads.rb +29 -0
  59. data/lib/dry/types/fn_container.rb +5 -0
  60. data/lib/dry/types/hash.rb +32 -14
  61. data/lib/dry/types/hash/constructor.rb +16 -3
  62. data/lib/dry/types/inflector.rb +2 -0
  63. data/lib/dry/types/json.rb +7 -5
  64. data/lib/dry/types/{safe.rb → lax.rb} +33 -16
  65. data/lib/dry/types/map.rb +70 -32
  66. data/lib/dry/types/meta.rb +51 -0
  67. data/lib/dry/types/module.rb +10 -5
  68. data/lib/dry/types/nominal.rb +105 -14
  69. data/lib/dry/types/options.rb +12 -25
  70. data/lib/dry/types/params.rb +14 -3
  71. data/lib/dry/types/predicate_inferrer.rb +197 -0
  72. data/lib/dry/types/predicate_registry.rb +34 -0
  73. data/lib/dry/types/primitive_inferrer.rb +97 -0
  74. data/lib/dry/types/printable.rb +5 -1
  75. data/lib/dry/types/printer.rb +70 -64
  76. data/lib/dry/types/result.rb +26 -0
  77. data/lib/dry/types/schema.rb +177 -80
  78. data/lib/dry/types/schema/key.rb +48 -35
  79. data/lib/dry/types/spec/types.rb +43 -6
  80. data/lib/dry/types/sum.rb +70 -21
  81. data/lib/dry/types/type.rb +49 -0
  82. data/lib/dry/types/version.rb +3 -1
  83. metadata +91 -62
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dry
2
4
  module Types
3
- VERSION = '0.15.0'.freeze
5
+ VERSION = '1.2.0'
4
6
  end
5
7
  end
metadata CHANGED
@@ -1,188 +1,188 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-types
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-22 00:00:00.000000000 Z
11
+ date: 2019-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: concurrent-ruby
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
18
  version: '1.0'
20
- type: :runtime
19
+ name: concurrent-ruby
21
20
  prerelease: false
21
+ type: :runtime
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: dry-core
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - "~>"
32
31
  - !ruby/object:Gem::Version
33
- version: '0.4'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 0.4.4
37
- type: :runtime
32
+ version: '0.3'
33
+ name: dry-container
38
34
  prerelease: false
35
+ type: :runtime
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - "~>"
42
39
  - !ruby/object:Gem::Version
43
- version: '0.4'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 0.4.4
40
+ version: '0.3'
47
41
  - !ruby/object:Gem::Dependency
48
- name: dry-inflector
49
42
  requirement: !ruby/object:Gem::Requirement
50
43
  requirements:
51
44
  - - "~>"
52
45
  - !ruby/object:Gem::Version
53
- version: '0.1'
46
+ version: '0.4'
54
47
  - - ">="
55
48
  - !ruby/object:Gem::Version
56
- version: 0.1.2
57
- type: :runtime
49
+ version: 0.4.4
50
+ name: dry-core
58
51
  prerelease: false
52
+ type: :runtime
59
53
  version_requirements: !ruby/object:Gem::Requirement
60
54
  requirements:
61
55
  - - "~>"
62
56
  - !ruby/object:Gem::Version
63
- version: '0.1'
57
+ version: '0.4'
64
58
  - - ">="
65
59
  - !ruby/object:Gem::Version
66
- version: 0.1.2
60
+ version: 0.4.4
67
61
  - !ruby/object:Gem::Dependency
68
- name: dry-container
69
62
  requirement: !ruby/object:Gem::Requirement
70
63
  requirements:
71
64
  - - "~>"
72
65
  - !ruby/object:Gem::Version
73
- version: '0.3'
74
- type: :runtime
66
+ version: '0.2'
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 0.2.2
70
+ name: dry-equalizer
75
71
  prerelease: false
72
+ type: :runtime
76
73
  version_requirements: !ruby/object:Gem::Requirement
77
74
  requirements:
78
75
  - - "~>"
79
76
  - !ruby/object:Gem::Version
80
- version: '0.3'
77
+ version: '0.2'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 0.2.2
81
81
  - !ruby/object:Gem::Dependency
82
- name: dry-equalizer
83
82
  requirement: !ruby/object:Gem::Requirement
84
83
  requirements:
85
84
  - - "~>"
86
85
  - !ruby/object:Gem::Version
87
- version: '0.2'
86
+ version: '0.1'
88
87
  - - ">="
89
88
  - !ruby/object:Gem::Version
90
- version: 0.2.2
91
- type: :runtime
89
+ version: 0.1.2
90
+ name: dry-inflector
92
91
  prerelease: false
92
+ type: :runtime
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - "~>"
96
96
  - !ruby/object:Gem::Version
97
- version: '0.2'
97
+ version: '0.1'
98
98
  - - ">="
99
99
  - !ruby/object:Gem::Version
100
- version: 0.2.2
100
+ version: 0.1.2
101
101
  - !ruby/object:Gem::Dependency
102
- name: dry-logic
103
102
  requirement: !ruby/object:Gem::Requirement
104
103
  requirements:
105
- - - ">="
106
- - !ruby/object:Gem::Version
107
- version: '0.5'
108
104
  - - "~>"
109
105
  - !ruby/object:Gem::Version
110
- version: '0.5'
111
- type: :runtime
106
+ version: '1.0'
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: 1.0.2
110
+ name: dry-logic
112
111
  prerelease: false
112
+ type: :runtime
113
113
  version_requirements: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0.5'
118
115
  - - "~>"
119
116
  - !ruby/object:Gem::Version
120
- version: '0.5'
117
+ version: '1.0'
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: 1.0.2
121
121
  - !ruby/object:Gem::Dependency
122
- name: bundler
123
122
  requirement: !ruby/object:Gem::Requirement
124
123
  requirements:
125
124
  - - ">="
126
125
  - !ruby/object:Gem::Version
127
126
  version: '0'
128
- type: :development
127
+ name: bundler
129
128
  prerelease: false
129
+ type: :development
130
130
  version_requirements: !ruby/object:Gem::Requirement
131
131
  requirements:
132
132
  - - ">="
133
133
  - !ruby/object:Gem::Version
134
134
  version: '0'
135
135
  - !ruby/object:Gem::Dependency
136
- name: rake
137
136
  requirement: !ruby/object:Gem::Requirement
138
137
  requirements:
139
138
  - - "~>"
140
139
  - !ruby/object:Gem::Version
141
- version: '11.0'
142
- type: :development
140
+ version: '0.2'
141
+ name: dry-monads
143
142
  prerelease: false
143
+ type: :development
144
144
  version_requirements: !ruby/object:Gem::Requirement
145
145
  requirements:
146
146
  - - "~>"
147
147
  - !ruby/object:Gem::Version
148
- version: '11.0'
148
+ version: '0.2'
149
149
  - !ruby/object:Gem::Dependency
150
- name: rspec
151
150
  requirement: !ruby/object:Gem::Requirement
152
151
  requirements:
153
152
  - - "~>"
154
153
  - !ruby/object:Gem::Version
155
- version: '3.3'
156
- type: :development
154
+ version: '11.0'
155
+ name: rake
157
156
  prerelease: false
157
+ type: :development
158
158
  version_requirements: !ruby/object:Gem::Requirement
159
159
  requirements:
160
160
  - - "~>"
161
161
  - !ruby/object:Gem::Version
162
- version: '3.3'
162
+ version: '11.0'
163
163
  - !ruby/object:Gem::Dependency
164
- name: dry-monads
165
164
  requirement: !ruby/object:Gem::Requirement
166
165
  requirements:
167
166
  - - "~>"
168
167
  - !ruby/object:Gem::Version
169
- version: '0.2'
170
- type: :development
168
+ version: '3.3'
169
+ name: rspec
171
170
  prerelease: false
171
+ type: :development
172
172
  version_requirements: !ruby/object:Gem::Requirement
173
173
  requirements:
174
174
  - - "~>"
175
175
  - !ruby/object:Gem::Version
176
- version: '0.2'
176
+ version: '3.3'
177
177
  - !ruby/object:Gem::Dependency
178
- name: yard
179
178
  requirement: !ruby/object:Gem::Requirement
180
179
  requirements:
181
180
  - - "~>"
182
181
  - !ruby/object:Gem::Version
183
182
  version: 0.9.5
184
- type: :development
183
+ name: yard
185
184
  prerelease: false
185
+ type: :development
186
186
  version_requirements: !ruby/object:Gem::Requirement
187
187
  requirements:
188
188
  - - "~>"
@@ -197,6 +197,9 @@ extensions: []
197
197
  extra_rdoc_files: []
198
198
  files:
199
199
  - ".codeclimate.yml"
200
+ - ".github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md"
201
+ - ".github/ISSUE_TEMPLATE/---bug-report.md"
202
+ - ".github/ISSUE_TEMPLATE/---feature-request.md"
200
203
  - ".gitignore"
201
204
  - ".rspec"
202
205
  - ".rubocop.yml"
@@ -209,11 +212,30 @@ files:
209
212
  - README.md
210
213
  - Rakefile
211
214
  - benchmarks/hash_schemas.rb
215
+ - benchmarks/lax_schema.rb
216
+ - benchmarks/profile_invalid_input.rb
217
+ - benchmarks/profile_lax_schema_valid.rb
218
+ - benchmarks/profile_valid_input.rb
219
+ - benchmarks/schema_valid_vs_invalid.rb
220
+ - benchmarks/setup.rb
221
+ - docsite/source/array-with-member.html.md
222
+ - docsite/source/built-in-types.html.md
223
+ - docsite/source/constraints.html.md
224
+ - docsite/source/custom-types.html.md
225
+ - docsite/source/default-values.html.md
226
+ - docsite/source/enum.html.md
227
+ - docsite/source/getting-started.html.md
228
+ - docsite/source/hash-schemas.html.md
229
+ - docsite/source/index.html.md
230
+ - docsite/source/map.html.md
231
+ - docsite/source/optional-values.html.md
232
+ - docsite/source/sum.html.md
212
233
  - dry-types.gemspec
213
234
  - lib/dry-types.rb
214
235
  - lib/dry/types.rb
215
236
  - lib/dry/types/any.rb
216
237
  - lib/dry/types/array.rb
238
+ - lib/dry/types/array/constructor.rb
217
239
  - lib/dry/types/array/member.rb
218
240
  - lib/dry/types/builder.rb
219
241
  - lib/dry/types/builder_methods.rb
@@ -226,6 +248,7 @@ files:
226
248
  - lib/dry/types/constrained/coercible.rb
227
249
  - lib/dry/types/constraints.rb
228
250
  - lib/dry/types/constructor.rb
251
+ - lib/dry/types/constructor/function.rb
229
252
  - lib/dry/types/container.rb
230
253
  - lib/dry/types/core.rb
231
254
  - lib/dry/types/decorator.rb
@@ -234,20 +257,25 @@ files:
234
257
  - lib/dry/types/errors.rb
235
258
  - lib/dry/types/extensions.rb
236
259
  - lib/dry/types/extensions/maybe.rb
260
+ - lib/dry/types/extensions/monads.rb
237
261
  - lib/dry/types/fn_container.rb
238
262
  - lib/dry/types/hash.rb
239
263
  - lib/dry/types/hash/constructor.rb
240
264
  - lib/dry/types/inflector.rb
241
265
  - lib/dry/types/json.rb
266
+ - lib/dry/types/lax.rb
242
267
  - lib/dry/types/map.rb
268
+ - lib/dry/types/meta.rb
243
269
  - lib/dry/types/module.rb
244
270
  - lib/dry/types/nominal.rb
245
271
  - lib/dry/types/options.rb
246
272
  - lib/dry/types/params.rb
273
+ - lib/dry/types/predicate_inferrer.rb
274
+ - lib/dry/types/predicate_registry.rb
275
+ - lib/dry/types/primitive_inferrer.rb
247
276
  - lib/dry/types/printable.rb
248
277
  - lib/dry/types/printer.rb
249
278
  - lib/dry/types/result.rb
250
- - lib/dry/types/safe.rb
251
279
  - lib/dry/types/schema.rb
252
280
  - lib/dry/types/schema/key.rb
253
281
  - lib/dry/types/spec/types.rb
@@ -263,7 +291,7 @@ metadata:
263
291
  changelog_uri: https://github.com/dry-rb/dry-types/blob/master/CHANGELOG.md
264
292
  source_code_uri: https://github.com/dry-rb/dry-types
265
293
  bug_tracker_uri: https://github.com/dry-rb/dry-types/issues
266
- post_install_message:
294
+ post_install_message:
267
295
  rdoc_options: []
268
296
  require_paths:
269
297
  - lib
@@ -271,15 +299,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
271
299
  requirements:
272
300
  - - ">="
273
301
  - !ruby/object:Gem::Version
274
- version: 2.3.0
302
+ version: 2.4.0
275
303
  required_rubygems_version: !ruby/object:Gem::Requirement
276
304
  requirements:
277
305
  - - ">="
278
306
  - !ruby/object:Gem::Version
279
307
  version: '0'
280
308
  requirements: []
281
- rubygems_version: 3.0.3
282
- signing_key:
309
+ rubyforge_project:
310
+ rubygems_version: 2.7.9
311
+ signing_key:
283
312
  specification_version: 4
284
313
  summary: Type system for Ruby supporting coercions, constraints and complex types
285
314
  like structs, value objects, enums etc.