dry-mutations 0.8.100 → 0.8.126
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
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3a51c0378a48ee9ba94de944688ef5de6cfdf4b2
|
|
4
|
+
data.tar.gz: ea6228d48ce3edfabb879830db07c70d616a8bfd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6a4a4edae037ccdee1fe8c0c63b2db5c7f08258c258a2b427cfbb157bf6aa39484a9c656c0a04ccbca7ce524faabd4f0fa0b2a2f4339e4f50367fe297213d1d4
|
|
7
|
+
data.tar.gz: 71743ae9657e8546ecd5317713ba9287958984777466724ff1c1a4ed406665c21e24f3e711eaf3c35b72afccb28d3dcf555a408f92c8a0b97d31d824022cda24
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
module Dry
|
|
2
2
|
module Mutations
|
|
3
3
|
module DSL # :nodoc:
|
|
4
|
-
def self.Schema
|
|
5
|
-
Dry::Mutations.Schema
|
|
6
|
-
end
|
|
7
|
-
|
|
8
4
|
module Schema # :nodoc:
|
|
9
|
-
def schema
|
|
10
|
-
@schema ||= derived_schema
|
|
5
|
+
def schema input_processor: nil, **options, &block
|
|
6
|
+
@schema ||= derived_schema input_processor: input_processor, **options, &block
|
|
11
7
|
return @schema unless block_given?
|
|
12
8
|
|
|
13
9
|
@schema = Validation.Schema(@schema, **@schema.options, &Proc.new)
|
|
@@ -15,14 +11,19 @@ module Dry
|
|
|
15
11
|
|
|
16
12
|
private
|
|
17
13
|
|
|
18
|
-
def derived_schema
|
|
14
|
+
def derived_schema input_processor: nil, **options, &block
|
|
19
15
|
this = is_a?(Class) ? self : self.class
|
|
20
16
|
|
|
21
17
|
parent_with_schema = this.ancestors.drop(1).detect do |klazz|
|
|
22
18
|
next if [this, ::Mutations::Command, ::Dry::Mutations::Extensions::Command].include?(klazz)
|
|
23
19
|
klazz.respond_to?(:schema) && klazz.schema.is_a?(Validation::Schema)
|
|
24
20
|
end
|
|
25
|
-
|
|
21
|
+
|
|
22
|
+
if parent_with_schema
|
|
23
|
+
Class.new(parent_with_schema.schema.class).new
|
|
24
|
+
else
|
|
25
|
+
::Dry::Mutations.Schema(input_processor: input_processor, **options, &block)
|
|
26
|
+
end
|
|
26
27
|
end
|
|
27
28
|
end
|
|
28
29
|
end
|
|
@@ -18,12 +18,10 @@ module Dry
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
module Hole # :nodoc:
|
|
21
|
-
def
|
|
22
|
-
|
|
23
|
-
# @validation_result = schema.(@raw_inputs)
|
|
24
|
-
@inputs = Utils.Hash @raw_inputs
|
|
25
|
-
@errors = nil
|
|
21
|
+
def self.prepended base
|
|
22
|
+
base.class_eval { schema(input_processor: :noop) }
|
|
26
23
|
end
|
|
24
|
+
singleton_class.send :alias_method, :included, :prepended
|
|
27
25
|
end
|
|
28
26
|
|
|
29
27
|
# rubocop:disable Style/ConstantName
|
|
@@ -7,7 +7,7 @@ module Kernel # :nodoc:
|
|
|
7
7
|
::Dry::Mutations::Extensions.Outcome!(input)
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
def Schema(
|
|
11
|
-
::Dry::
|
|
10
|
+
def Schema(input_processor: nil, **options, &block)
|
|
11
|
+
::Dry::Mutations.Schema(input_processor: input_processor, **options, &block)
|
|
12
12
|
end
|
|
13
13
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: dry-mutations
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.126
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aleksei Matiushkin
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-08-
|
|
11
|
+
date: 2016-08-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|