dry-types 1.0.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md +10 -0
- data/.github/ISSUE_TEMPLATE/---bug-report.md +34 -0
- data/.github/ISSUE_TEMPLATE/---feature-request.md +18 -0
- data/.travis.yml +10 -4
- data/CHANGELOG.md +101 -3
- data/Gemfile +9 -6
- data/README.md +2 -2
- data/Rakefile +2 -2
- data/benchmarks/hash_schemas.rb +8 -6
- data/benchmarks/lax_schema.rb +0 -1
- data/benchmarks/profile_invalid_input.rb +1 -1
- data/benchmarks/profile_lax_schema_valid.rb +1 -1
- data/benchmarks/profile_valid_input.rb +1 -1
- data/docsite/source/array-with-member.html.md +13 -0
- data/docsite/source/built-in-types.html.md +116 -0
- data/docsite/source/constraints.html.md +31 -0
- data/docsite/source/custom-types.html.md +93 -0
- data/docsite/source/default-values.html.md +91 -0
- data/docsite/source/enum.html.md +69 -0
- data/docsite/source/getting-started.html.md +57 -0
- data/docsite/source/hash-schemas.html.md +169 -0
- data/docsite/source/index.html.md +155 -0
- data/docsite/source/map.html.md +17 -0
- data/docsite/source/optional-values.html.md +96 -0
- data/docsite/source/sum.html.md +21 -0
- data/dry-types.gemspec +19 -19
- data/lib/dry/types.rb +9 -4
- data/lib/dry/types/array.rb +6 -0
- data/lib/dry/types/array/constructor.rb +32 -0
- data/lib/dry/types/array/member.rb +8 -1
- data/lib/dry/types/builder.rb +1 -1
- data/lib/dry/types/builder_methods.rb +33 -23
- data/lib/dry/types/coercions.rb +19 -6
- data/lib/dry/types/coercions/params.rb +4 -4
- data/lib/dry/types/constrained.rb +5 -0
- data/lib/dry/types/constructor.rb +5 -37
- data/lib/dry/types/constructor/function.rb +4 -5
- data/lib/dry/types/core.rb +27 -8
- data/lib/dry/types/decorator.rb +1 -1
- data/lib/dry/types/enum.rb +1 -0
- data/lib/dry/types/extensions.rb +4 -0
- data/lib/dry/types/extensions/maybe.rb +9 -1
- data/lib/dry/types/extensions/monads.rb +29 -0
- data/lib/dry/types/hash.rb +10 -11
- data/lib/dry/types/hash/constructor.rb +5 -5
- data/lib/dry/types/json.rb +4 -0
- data/lib/dry/types/lax.rb +4 -4
- data/lib/dry/types/map.rb +8 -4
- data/lib/dry/types/module.rb +3 -3
- data/lib/dry/types/nominal.rb +3 -4
- data/lib/dry/types/params.rb +9 -0
- data/lib/dry/types/predicate_inferrer.rb +197 -0
- data/lib/dry/types/predicate_registry.rb +34 -0
- data/lib/dry/types/primitive_inferrer.rb +97 -0
- data/lib/dry/types/printer.rb +17 -12
- data/lib/dry/types/schema.rb +14 -20
- data/lib/dry/types/schema/key.rb +19 -1
- data/lib/dry/types/spec/types.rb +3 -6
- data/lib/dry/types/version.rb +1 -1
- metadata +79 -52
@@ -0,0 +1,97 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'dry/core/cache'
|
4
|
+
|
5
|
+
module Dry
|
6
|
+
module Types
|
7
|
+
# PrimitiveInferrer returns the list of classes matching a type.
|
8
|
+
#
|
9
|
+
# @api public
|
10
|
+
class PrimitiveInferrer
|
11
|
+
extend Core::Cache
|
12
|
+
|
13
|
+
# Compiler reduces type AST into a list of primitives
|
14
|
+
#
|
15
|
+
# @api private
|
16
|
+
class Compiler
|
17
|
+
# @api private
|
18
|
+
def visit(node)
|
19
|
+
meth, rest = node
|
20
|
+
public_send(:"visit_#{meth}", rest)
|
21
|
+
end
|
22
|
+
|
23
|
+
# @api private
|
24
|
+
def visit_nominal(node)
|
25
|
+
type, _ = node
|
26
|
+
type
|
27
|
+
end
|
28
|
+
|
29
|
+
# @api private
|
30
|
+
def visit_hash(_)
|
31
|
+
::Hash
|
32
|
+
end
|
33
|
+
alias_method :visit_schema, :visit_hash
|
34
|
+
|
35
|
+
# @api private
|
36
|
+
def visit_array(_)
|
37
|
+
::Array
|
38
|
+
end
|
39
|
+
|
40
|
+
# @api private
|
41
|
+
def visit_lax(node)
|
42
|
+
visit(node)
|
43
|
+
end
|
44
|
+
|
45
|
+
# @api private
|
46
|
+
def visit_constructor(node)
|
47
|
+
other, * = node
|
48
|
+
visit(other)
|
49
|
+
end
|
50
|
+
|
51
|
+
# @api private
|
52
|
+
def visit_enum(node)
|
53
|
+
other, * = node
|
54
|
+
visit(other)
|
55
|
+
end
|
56
|
+
|
57
|
+
# @api private
|
58
|
+
def visit_sum(node)
|
59
|
+
left, right = node
|
60
|
+
|
61
|
+
[visit(left), visit(right)].flatten(1)
|
62
|
+
end
|
63
|
+
|
64
|
+
# @api private
|
65
|
+
def visit_constrained(node)
|
66
|
+
other, * = node
|
67
|
+
visit(other)
|
68
|
+
end
|
69
|
+
|
70
|
+
# @api private
|
71
|
+
def visit_any(_)
|
72
|
+
::Object
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# @return [Compiler]
|
77
|
+
# @api private
|
78
|
+
attr_reader :compiler
|
79
|
+
|
80
|
+
# @api private
|
81
|
+
def initialize
|
82
|
+
@compiler = Compiler.new
|
83
|
+
end
|
84
|
+
|
85
|
+
# Infer primitives from the provided type
|
86
|
+
#
|
87
|
+
# @return [Array[Class]]
|
88
|
+
#
|
89
|
+
# @api private
|
90
|
+
def [](type)
|
91
|
+
self.class.fetch_or_store(type) do
|
92
|
+
Array(compiler.visit(type.to_ast)).freeze
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
data/lib/dry/types/printer.rb
CHANGED
@@ -8,6 +8,7 @@ module Dry
|
|
8
8
|
Nominal => :visit_nominal,
|
9
9
|
Constructor => :visit_constructor,
|
10
10
|
Hash::Constructor => :visit_constructor,
|
11
|
+
Array::Constructor => :visit_constructor,
|
11
12
|
Constrained => :visit_constrained,
|
12
13
|
Constrained::Coercible => :visit_constrained,
|
13
14
|
Hash => :visit_hash,
|
@@ -26,7 +27,7 @@ module Dry
|
|
26
27
|
}
|
27
28
|
|
28
29
|
def call(type)
|
29
|
-
output =
|
30
|
+
output = ''.dup
|
30
31
|
visit(type) { |str| output << str }
|
31
32
|
"#<Dry::Types[#{output}]>"
|
32
33
|
end
|
@@ -43,16 +44,20 @@ module Dry
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def visit_any(_)
|
46
|
-
yield
|
47
|
+
yield 'Any'
|
47
48
|
end
|
48
49
|
|
49
|
-
def visit_array(
|
50
|
-
|
50
|
+
def visit_array(type)
|
51
|
+
visit_options(EMPTY_HASH, type.meta) do |opts|
|
52
|
+
yield "Array#{opts}"
|
53
|
+
end
|
51
54
|
end
|
52
55
|
|
53
56
|
def visit_array_member(array)
|
54
57
|
visit(array.member) do |type|
|
55
|
-
|
58
|
+
visit_options(EMPTY_HASH, array.meta) do |opts|
|
59
|
+
yield "Array<#{type}#{opts}>"
|
60
|
+
end
|
56
61
|
end
|
57
62
|
end
|
58
63
|
|
@@ -74,7 +79,7 @@ module Dry
|
|
74
79
|
options = constrained.options.dup
|
75
80
|
rule = options.delete(:rule)
|
76
81
|
|
77
|
-
visit_options(options) do |
|
82
|
+
visit_options(options) do |_opts|
|
78
83
|
yield "Constrained<#{type} rule=[#{rule}]>"
|
79
84
|
end
|
80
85
|
end
|
@@ -110,7 +115,7 @@ module Dry
|
|
110
115
|
header = "Schema<#{schema_parameters}keys={"
|
111
116
|
|
112
117
|
if size.zero?
|
113
|
-
yield "#{
|
118
|
+
yield "#{header}}>"
|
114
119
|
else
|
115
120
|
yield header.dup << keys.map { |key|
|
116
121
|
visit(key) { |type| type }
|
@@ -126,7 +131,7 @@ module Dry
|
|
126
131
|
options.delete(:key_type)
|
127
132
|
options.delete(:value_type)
|
128
133
|
|
129
|
-
visit_options(options) do |
|
134
|
+
visit_options(options) do |_opts|
|
130
135
|
yield "Map<#{key} => #{value}>"
|
131
136
|
end
|
132
137
|
end
|
@@ -193,7 +198,7 @@ module Dry
|
|
193
198
|
yield "Enum<#{type} values={#{values}}#{opts}>"
|
194
199
|
else
|
195
200
|
mapping_str = mapping.map { |key, value|
|
196
|
-
"#{
|
201
|
+
"#{key.inspect}=>#{value.inspect}"
|
197
202
|
}.join(', ')
|
198
203
|
yield "Enum<#{type} mapping={#{mapping_str}}#{opts}>"
|
199
204
|
end
|
@@ -251,14 +256,14 @@ module Dry
|
|
251
256
|
|
252
257
|
case fn
|
253
258
|
when Method
|
254
|
-
yield "#{
|
259
|
+
yield "#{fn.receiver}.#{fn.name}"
|
255
260
|
when Proc
|
256
261
|
path, line = fn.source_location
|
257
262
|
|
258
|
-
if line
|
263
|
+
if line&.zero?
|
259
264
|
yield ".#{path}"
|
260
265
|
elsif path
|
261
|
-
yield "#{path.sub(Dir.pwd + '/', EMPTY_STRING)
|
266
|
+
yield "#{path.sub(Dir.pwd + '/', EMPTY_STRING)}:#{line}"
|
262
267
|
elsif fn.lambda?
|
263
268
|
yield '(lambda)'
|
264
269
|
else
|
data/lib/dry/types/schema.rb
CHANGED
@@ -156,8 +156,8 @@ module Dry
|
|
156
156
|
[
|
157
157
|
:schema,
|
158
158
|
[keys.map { |key| key.to_ast(meta: meta) },
|
159
|
-
|
160
|
-
|
159
|
+
opts,
|
160
|
+
meta ? self.meta : EMPTY_HASH]
|
161
161
|
]
|
162
162
|
end
|
163
163
|
|
@@ -190,9 +190,7 @@ module Dry
|
|
190
190
|
def with_key_transform(proc = nil, &block)
|
191
191
|
fn = proc || block
|
192
192
|
|
193
|
-
if fn.nil?
|
194
|
-
raise ArgumentError, "a block or callable argument is required"
|
195
|
-
end
|
193
|
+
raise ArgumentError, 'a block or callable argument is required' if fn.nil?
|
196
194
|
|
197
195
|
handle = Dry::Types::FnContainer.register(fn)
|
198
196
|
with(key_transform_fn: handle)
|
@@ -203,7 +201,7 @@ module Dry
|
|
203
201
|
# @return [Boolean]
|
204
202
|
#
|
205
203
|
# @api public
|
206
|
-
def
|
204
|
+
def transform_keys?
|
207
205
|
!options[:key_transform_fn].nil?
|
208
206
|
end
|
209
207
|
|
@@ -294,10 +292,10 @@ module Dry
|
|
294
292
|
#
|
295
293
|
# @api private
|
296
294
|
def merge_keys(*keys)
|
297
|
-
keys
|
298
|
-
flatten(1)
|
299
|
-
each_with_object({}) { |key, merged| merged[key.name] = key }
|
300
|
-
values
|
295
|
+
keys
|
296
|
+
.flatten(1)
|
297
|
+
.each_with_object({}) { |key, merged| merged[key.name] = key }
|
298
|
+
.values
|
301
299
|
end
|
302
300
|
|
303
301
|
# Validate and coerce a hash. Raise an exception on any error
|
@@ -315,19 +313,17 @@ module Dry
|
|
315
313
|
if type
|
316
314
|
begin
|
317
315
|
result[k] = type.call_unsafe(value)
|
318
|
-
rescue ConstraintError =>
|
319
|
-
raise SchemaError.new(type.name, value,
|
320
|
-
rescue CoercionError =>
|
321
|
-
raise SchemaError.new(type.name, value,
|
316
|
+
rescue ConstraintError => e
|
317
|
+
raise SchemaError.new(type.name, value, e.result)
|
318
|
+
rescue CoercionError => e
|
319
|
+
raise SchemaError.new(type.name, value, e.message)
|
322
320
|
end
|
323
321
|
elsif strict?
|
324
322
|
raise unexpected_keys(hash.keys)
|
325
323
|
end
|
326
324
|
end
|
327
325
|
|
328
|
-
if result.size < keys.size
|
329
|
-
resolve_missing_keys(result, options)
|
330
|
-
end
|
326
|
+
resolve_missing_keys(result, options) if result.size < keys.size
|
331
327
|
|
332
328
|
result
|
333
329
|
end
|
@@ -351,9 +347,7 @@ module Dry
|
|
351
347
|
end
|
352
348
|
end
|
353
349
|
|
354
|
-
if result.size < keys.size
|
355
|
-
resolve_missing_keys(result, options, &block)
|
356
|
-
end
|
350
|
+
resolve_missing_keys(result, options, &block) if result.size < keys.size
|
357
351
|
|
358
352
|
result
|
359
353
|
end
|
data/lib/dry/types/schema/key.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'dry/equalizer'
|
4
|
+
require 'dry/core/deprecations'
|
4
5
|
|
5
6
|
module Dry
|
6
7
|
module Types
|
@@ -14,6 +15,7 @@ module Dry
|
|
14
15
|
#
|
15
16
|
# @see Dry::Types::Schema
|
16
17
|
class Key
|
18
|
+
extend ::Dry::Core::Deprecations[:'dry-types']
|
17
19
|
include Type
|
18
20
|
include Dry::Equalizer(:name, :type, :options, inspect: false)
|
19
21
|
include Decorator
|
@@ -94,7 +96,7 @@ module Dry
|
|
94
96
|
#
|
95
97
|
# @api public
|
96
98
|
def lax
|
97
|
-
|
99
|
+
__new__(type.lax).required(false)
|
98
100
|
end
|
99
101
|
|
100
102
|
# Dump to internal AST representation
|
@@ -113,6 +115,22 @@ module Dry
|
|
113
115
|
]
|
114
116
|
end
|
115
117
|
|
118
|
+
# @see Dry::Types::Meta#meta
|
119
|
+
#
|
120
|
+
# @api public
|
121
|
+
def meta(data = nil)
|
122
|
+
if data.nil? || !data.key?(:omittable)
|
123
|
+
super
|
124
|
+
else
|
125
|
+
self.class.warn(
|
126
|
+
'Using meta for making schema keys is deprecated, ' \
|
127
|
+
'please use .omittable or .required(false) instead' \
|
128
|
+
"\n" + Core::Deprecations::STACK.()
|
129
|
+
)
|
130
|
+
super.required(!data[:omittable])
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
116
134
|
private
|
117
135
|
|
118
136
|
# @api private
|
data/lib/dry/types/spec/types.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
RSpec.shared_examples_for 'Dry::Types::Nominal without primitive' do
|
4
4
|
def be_boolean
|
5
|
-
satisfy { |x| x == true || x == false
|
5
|
+
satisfy { |x| x == true || x == false }
|
6
6
|
end
|
7
7
|
|
8
8
|
describe '#constrained?' do
|
@@ -43,9 +43,7 @@ RSpec.shared_examples_for 'Dry::Types::Nominal without primitive' do
|
|
43
43
|
|
44
44
|
describe '#to_s' do
|
45
45
|
it 'returns a custom string representation' do
|
46
|
-
if type.class.name.start_with?('Dry::Types')
|
47
|
-
expect(type.to_s).to start_with('#<Dry::Types')
|
48
|
-
end
|
46
|
+
expect(type.to_s).to start_with('#<Dry::Types') if type.class.name.start_with?('Dry::Types')
|
49
47
|
end
|
50
48
|
end
|
51
49
|
|
@@ -81,7 +79,7 @@ RSpec.shared_examples_for 'Dry::Types::Nominal#meta' do
|
|
81
79
|
expect(type.meta).not_to have_key :immutable_test
|
82
80
|
derived = type.meta(immutable_test: 1)
|
83
81
|
expect(derived.meta).to be_frozen
|
84
|
-
expect(derived.meta).to eql(
|
82
|
+
expect(derived.meta).to eql(immutable_test: 1)
|
85
83
|
expect(type.meta).not_to have_key :immutable_test
|
86
84
|
end
|
87
85
|
end
|
@@ -139,4 +137,3 @@ RSpec.shared_examples_for 'a nominal type' do |inputs: Object.new|
|
|
139
137
|
end
|
140
138
|
end
|
141
139
|
end
|
142
|
-
|
data/lib/dry/types/version.rb
CHANGED
metadata
CHANGED
@@ -1,182 +1,188 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-types
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.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-06
|
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
|
-
|
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.
|
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.
|
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.
|
46
|
+
version: '0.4'
|
54
47
|
- - ">="
|
55
48
|
- !ruby/object:Gem::Version
|
56
|
-
version: 0.
|
57
|
-
|
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.
|
57
|
+
version: '0.4'
|
64
58
|
- - ">="
|
65
59
|
- !ruby/object:Gem::Version
|
66
|
-
version: 0.
|
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.
|
74
|
-
|
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.
|
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.
|
86
|
+
version: '0.1'
|
88
87
|
- - ">="
|
89
88
|
- !ruby/object:Gem::Version
|
90
|
-
version: 0.
|
91
|
-
|
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.
|
97
|
+
version: '0.1'
|
98
98
|
- - ">="
|
99
99
|
- !ruby/object:Gem::Version
|
100
|
-
version: 0.
|
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
104
|
- - "~>"
|
106
105
|
- !ruby/object:Gem::Version
|
107
106
|
version: '1.0'
|
108
|
-
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.0.2
|
110
|
+
name: dry-logic
|
109
111
|
prerelease: false
|
112
|
+
type: :runtime
|
110
113
|
version_requirements: !ruby/object:Gem::Requirement
|
111
114
|
requirements:
|
112
115
|
- - "~>"
|
113
116
|
- !ruby/object:Gem::Version
|
114
117
|
version: '1.0'
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 1.0.2
|
115
121
|
- !ruby/object:Gem::Dependency
|
116
|
-
name: bundler
|
117
122
|
requirement: !ruby/object:Gem::Requirement
|
118
123
|
requirements:
|
119
124
|
- - ">="
|
120
125
|
- !ruby/object:Gem::Version
|
121
126
|
version: '0'
|
122
|
-
|
127
|
+
name: bundler
|
123
128
|
prerelease: false
|
129
|
+
type: :development
|
124
130
|
version_requirements: !ruby/object:Gem::Requirement
|
125
131
|
requirements:
|
126
132
|
- - ">="
|
127
133
|
- !ruby/object:Gem::Version
|
128
134
|
version: '0'
|
129
135
|
- !ruby/object:Gem::Dependency
|
130
|
-
name: rake
|
131
136
|
requirement: !ruby/object:Gem::Requirement
|
132
137
|
requirements:
|
133
138
|
- - "~>"
|
134
139
|
- !ruby/object:Gem::Version
|
135
|
-
version: '
|
136
|
-
|
140
|
+
version: '0.2'
|
141
|
+
name: dry-monads
|
137
142
|
prerelease: false
|
143
|
+
type: :development
|
138
144
|
version_requirements: !ruby/object:Gem::Requirement
|
139
145
|
requirements:
|
140
146
|
- - "~>"
|
141
147
|
- !ruby/object:Gem::Version
|
142
|
-
version: '
|
148
|
+
version: '0.2'
|
143
149
|
- !ruby/object:Gem::Dependency
|
144
|
-
name: rspec
|
145
150
|
requirement: !ruby/object:Gem::Requirement
|
146
151
|
requirements:
|
147
152
|
- - "~>"
|
148
153
|
- !ruby/object:Gem::Version
|
149
|
-
version: '
|
150
|
-
|
154
|
+
version: '11.0'
|
155
|
+
name: rake
|
151
156
|
prerelease: false
|
157
|
+
type: :development
|
152
158
|
version_requirements: !ruby/object:Gem::Requirement
|
153
159
|
requirements:
|
154
160
|
- - "~>"
|
155
161
|
- !ruby/object:Gem::Version
|
156
|
-
version: '
|
162
|
+
version: '11.0'
|
157
163
|
- !ruby/object:Gem::Dependency
|
158
|
-
name: dry-monads
|
159
164
|
requirement: !ruby/object:Gem::Requirement
|
160
165
|
requirements:
|
161
166
|
- - "~>"
|
162
167
|
- !ruby/object:Gem::Version
|
163
|
-
version: '
|
164
|
-
|
168
|
+
version: '3.3'
|
169
|
+
name: rspec
|
165
170
|
prerelease: false
|
171
|
+
type: :development
|
166
172
|
version_requirements: !ruby/object:Gem::Requirement
|
167
173
|
requirements:
|
168
174
|
- - "~>"
|
169
175
|
- !ruby/object:Gem::Version
|
170
|
-
version: '
|
176
|
+
version: '3.3'
|
171
177
|
- !ruby/object:Gem::Dependency
|
172
|
-
name: yard
|
173
178
|
requirement: !ruby/object:Gem::Requirement
|
174
179
|
requirements:
|
175
180
|
- - "~>"
|
176
181
|
- !ruby/object:Gem::Version
|
177
182
|
version: 0.9.5
|
178
|
-
|
183
|
+
name: yard
|
179
184
|
prerelease: false
|
185
|
+
type: :development
|
180
186
|
version_requirements: !ruby/object:Gem::Requirement
|
181
187
|
requirements:
|
182
188
|
- - "~>"
|
@@ -191,6 +197,9 @@ extensions: []
|
|
191
197
|
extra_rdoc_files: []
|
192
198
|
files:
|
193
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"
|
194
203
|
- ".gitignore"
|
195
204
|
- ".rspec"
|
196
205
|
- ".rubocop.yml"
|
@@ -209,11 +218,24 @@ files:
|
|
209
218
|
- benchmarks/profile_valid_input.rb
|
210
219
|
- benchmarks/schema_valid_vs_invalid.rb
|
211
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
|
@@ -235,6 +257,7 @@ files:
|
|
235
257
|
- lib/dry/types/errors.rb
|
236
258
|
- lib/dry/types/extensions.rb
|
237
259
|
- lib/dry/types/extensions/maybe.rb
|
260
|
+
- lib/dry/types/extensions/monads.rb
|
238
261
|
- lib/dry/types/fn_container.rb
|
239
262
|
- lib/dry/types/hash.rb
|
240
263
|
- lib/dry/types/hash/constructor.rb
|
@@ -247,6 +270,9 @@ files:
|
|
247
270
|
- lib/dry/types/nominal.rb
|
248
271
|
- lib/dry/types/options.rb
|
249
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
|
250
276
|
- lib/dry/types/printable.rb
|
251
277
|
- lib/dry/types/printer.rb
|
252
278
|
- lib/dry/types/result.rb
|
@@ -265,7 +291,7 @@ metadata:
|
|
265
291
|
changelog_uri: https://github.com/dry-rb/dry-types/blob/master/CHANGELOG.md
|
266
292
|
source_code_uri: https://github.com/dry-rb/dry-types
|
267
293
|
bug_tracker_uri: https://github.com/dry-rb/dry-types/issues
|
268
|
-
post_install_message:
|
294
|
+
post_install_message:
|
269
295
|
rdoc_options: []
|
270
296
|
require_paths:
|
271
297
|
- lib
|
@@ -280,8 +306,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
306
|
- !ruby/object:Gem::Version
|
281
307
|
version: '0'
|
282
308
|
requirements: []
|
283
|
-
|
284
|
-
|
309
|
+
rubyforge_project:
|
310
|
+
rubygems_version: 2.7.9
|
311
|
+
signing_key:
|
285
312
|
specification_version: 4
|
286
313
|
summary: Type system for Ruby supporting coercions, constraints and complex types
|
287
314
|
like structs, value objects, enums etc.
|