dry-schema 1.3.2 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,7 +32,7 @@ module Dry
32
32
  option :message_compiler
33
33
 
34
34
  # @api private
35
- def self.new(*args)
35
+ def self.new(*, **)
36
36
  result = super
37
37
  yield(result)
38
38
  result.freeze
@@ -18,12 +18,12 @@ module Dry
18
18
  attr_reader :namespace
19
19
 
20
20
  # @api private
21
- def self.new(types = Dry::Types, namespace = :nominal)
21
+ def self.new(types = Dry::Types, namespace = :strict)
22
22
  super
23
23
  end
24
24
 
25
25
  # @api private
26
- def initialize(types, namespace = :nominal)
26
+ def initialize(types, namespace = :strict)
27
27
  @types = types
28
28
  @namespace = namespace
29
29
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Schema
5
- VERSION = '1.3.2'
5
+ VERSION = '1.4.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-01 00:00:00.000000000 Z
11
+ date: 2019-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -106,14 +106,14 @@ dependencies:
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '1.0'
109
+ version: '1.2'
110
110
  type: :runtime
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '1.0'
116
+ version: '1.2'
117
117
  - !ruby/object:Gem::Dependency
118
118
  name: bundler
119
119
  requirement: !ruby/object:Gem::Requirement
@@ -217,8 +217,8 @@ files:
217
217
  - lib/dry/schema/predicate.rb
218
218
  - lib/dry/schema/predicate_inferrer.rb
219
219
  - lib/dry/schema/predicate_registry.rb
220
- - lib/dry/schema/primitive_inferrer.rb
221
220
  - lib/dry/schema/processor.rb
221
+ - lib/dry/schema/processor_steps.rb
222
222
  - lib/dry/schema/result.rb
223
223
  - lib/dry/schema/rule_applier.rb
224
224
  - lib/dry/schema/trace.rb
@@ -1,98 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'dry/core/cache'
4
-
5
- module Dry
6
- module Schema
7
- # PrimitiveInferrer is used internally by `Macros::Filled`
8
- # for inferring a list of possible primitives that a given
9
- # type can handle.
10
- #
11
- # @api private
12
- class PrimitiveInferrer
13
- extend Dry::Core::Cache
14
-
15
- # Compiler reduces type AST into a list of primitives
16
- #
17
- # @api private
18
- class Compiler
19
- # @api private
20
- def visit(node)
21
- meth, rest = node
22
- public_send(:"visit_#{meth}", rest)
23
- end
24
-
25
- # @api private
26
- def visit_nominal(node)
27
- type, _ = node
28
- type
29
- end
30
-
31
- # @api private
32
- def visit_hash(_)
33
- Hash
34
- end
35
-
36
- # @api private
37
- def visit_array(_)
38
- Array
39
- end
40
-
41
- # @api private
42
- def visit_lax(node)
43
- visit(node)
44
- end
45
-
46
- # @api private
47
- def visit_constructor(node)
48
- other, * = node
49
- visit(other)
50
- end
51
-
52
- # @api private
53
- def visit_enum(node)
54
- other, * = node
55
- visit(other)
56
- end
57
-
58
- # @api private
59
- def visit_sum(node)
60
- left, right = node
61
-
62
- [visit(left), visit(right)].flatten(1)
63
- end
64
-
65
- # @api private
66
- def visit_constrained(node)
67
- other, * = node
68
- visit(other)
69
- end
70
-
71
- # @api private
72
- def visit_any(_)
73
- Object
74
- end
75
- end
76
-
77
- # @return [Compiler]
78
- # @api private
79
- attr_reader :compiler
80
-
81
- # @api private
82
- def initialize
83
- @compiler = Compiler.new
84
- end
85
-
86
- # Infer predicate identifier from the provided type
87
- #
88
- # @return [Symbol]
89
- #
90
- # @api private
91
- def [](type)
92
- self.class.fetch_or_store(type.hash) do
93
- Array(compiler.visit(type.to_ast)).freeze
94
- end
95
- end
96
- end
97
- end
98
- end