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: 0357bd763332f13cacbf1dcfb8ecec93f95998ec
4
- data.tar.gz: 40e592f6c305d2252a9871f52392e2684cbf06db
3
+ metadata.gz: 3a51c0378a48ee9ba94de944688ef5de6cfdf4b2
4
+ data.tar.gz: ea6228d48ce3edfabb879830db07c70d616a8bfd
5
5
  SHA512:
6
- metadata.gz: 3754f02f48ee851d51ef5d829ccb317cfe7d7ea171d6c1dd399f05b6da4fbe0f291e2f106834d6de59efc3d5c85de5d847617400ea111b2b27c708b7903bb145
7
- data.tar.gz: 1e0ee6ee7d9c09052b67a8b227ead49f4b5970ffb222916f307da7f9ed8a896f49dcead47752a8346706ac87161a8a3d62f9d09f67e175a0a52e6dde2af62cee
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
- parent_with_schema ? Class.new(parent_with_schema.schema.class).new : ::Dry::Mutations::DSL::Schema()
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 initialize(*args)
22
- @raw_inputs = Utils.RawInputs(*args)
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(options = {}, &block)
11
- ::Dry::Validation.Schema(::Dry::Mutations::DSL.Schema(), options, &block)
10
+ def Schema(input_processor: nil, **options, &block)
11
+ ::Dry::Mutations.Schema(input_processor: input_processor, **options, &block)
12
12
  end
13
13
  end
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module Mutations
3
- VERSION = '0.8.100'.freeze
3
+ VERSION = '0.8.126'.freeze
4
4
  end
5
5
  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.100
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-09 00:00:00.000000000 Z
11
+ date: 2016-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler