use_cases 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/use_cases/module_optins/publishing.rb +2 -0
- data/lib/use_cases/module_optins/validated.rb +15 -6
- data/lib/use_cases/version.rb +1 -1
- data/lib/use_cases.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1acf28555c44f6ddde193195d340f9ea4dc9d3ffce2ec9ad5302d626bc3fa07a
|
4
|
+
data.tar.gz: eebecd33d8f5f64e0fc73e1174e7e32b7252d88f1c2de8543297ec3fd78fbab4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e728db5f63082ce761579c57bf3b9ab22a2059d5720823bfda3c90105b60be10dc7e93ad7d0c87cef7b848bbc2ffd061a4cd806e386c030b34b39c04974ae12
|
7
|
+
data.tar.gz: 7f04086052168ba6af1933d2e196fbb4e5053188270b72f3ebf245007863be40695aa10d3dc98c7ea53845c3f88bebb68d35f5a316f39203b36e0906694623df
|
@@ -32,29 +32,36 @@ module UseCases
|
|
32
32
|
def params(*args, &blk)
|
33
33
|
_setup_validation
|
34
34
|
|
35
|
-
_contract_class.params(*args, &blk)
|
35
|
+
_contract_class.params(*args, &block_with_config(&blk))
|
36
36
|
end
|
37
37
|
|
38
38
|
def schema(*args, &blk)
|
39
39
|
_setup_validation
|
40
40
|
|
41
|
-
_contract_class.schema(*args, &blk)
|
41
|
+
_contract_class.schema(*args, &block_with_config(&blk))
|
42
42
|
end
|
43
43
|
|
44
44
|
def rule(*args, &blk)
|
45
45
|
_setup_validation
|
46
46
|
|
47
|
-
_contract_class.rule(*args, &blk)
|
47
|
+
_contract_class.rule(*args, &block_with_config(&blk))
|
48
48
|
end
|
49
49
|
|
50
50
|
def json(*args, &blk)
|
51
51
|
_setup_validation
|
52
52
|
|
53
|
-
_contract_class.json(*args, &blk)
|
53
|
+
_contract_class.json(*args, &block_with_config(&blk))
|
54
54
|
end
|
55
55
|
|
56
56
|
def option(*args, &blk)
|
57
|
-
_contract_class.option(*args, &blk)
|
57
|
+
_contract_class.option(*args, &block_with_config(&blk))
|
58
|
+
end
|
59
|
+
|
60
|
+
def block_with_config(&blk)
|
61
|
+
Proc.new do
|
62
|
+
instance_exec(&UseCases.dry_validation)
|
63
|
+
instance_exec(&blk)
|
64
|
+
end
|
58
65
|
end
|
59
66
|
end
|
60
67
|
|
@@ -74,7 +81,9 @@ module UseCases
|
|
74
81
|
end
|
75
82
|
|
76
83
|
def contract
|
77
|
-
return
|
84
|
+
return unless self.class._contract_class_defined?
|
85
|
+
|
86
|
+
self.class._contract_class.new
|
78
87
|
end
|
79
88
|
|
80
89
|
module ClassMethods
|
data/lib/use_cases/version.rb
CHANGED
data/lib/use_cases.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "dry/configurable"
|
4
|
+
require "dry/types"
|
4
5
|
|
5
6
|
require_relative "use_case"
|
6
7
|
require_relative "use_cases/version"
|
@@ -17,4 +18,13 @@ module UseCases
|
|
17
18
|
setting :container, reader: true
|
18
19
|
setting :publisher, default: ::UseCases::Events::Publisher.new, reader: true
|
19
20
|
setting :subscribers, default: [], reader: true
|
21
|
+
setting :dry_validation, default: ->(config) {}
|
22
|
+
|
23
|
+
def self.dry_validation
|
24
|
+
config_proc = config.dry_validation
|
25
|
+
|
26
|
+
Proc.new do
|
27
|
+
config_proc.call(config)
|
28
|
+
end
|
29
|
+
end
|
20
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: use_cases
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ring Twice
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|