servactory 1.6.8 → 1.6.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/servactory/inputs/input.rb +24 -0
- data/lib/servactory/inputs/tools/prepare.rb +3 -0
- data/lib/servactory/version.rb +1 -1
- 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: 2c500354cf4e4fdb64d43928419b2d5d90eb99a7f4075bb7b92c78fa0f498748
|
4
|
+
data.tar.gz: ffd1d27087d1f5ad5457738c20cda5cb9fa73821fca05cc9cf3161c0c035fb71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '039459dc8df65093417fe4b6703783e43ace1c401f86b9b067d5ce3aeeebd0f64866561904a15ea299c2be15224fb66a1fe71dfc8477d7e0f12458f086c09b8a'
|
7
|
+
data.tar.gz: 794a191acdc4f2d94d8b827d05c1994a4e644a2124ac2e8fc83106abcfdeb80b35fc069a413c89cf98fc43b22b5f343bb96070d38ed05ffd3f7123d741fc3256
|
@@ -63,6 +63,7 @@ module Servactory
|
|
63
63
|
add_must_option_with(options)
|
64
64
|
|
65
65
|
# Check Class: nil
|
66
|
+
add_prepare_option_with(options)
|
66
67
|
add_internal_option_with(options)
|
67
68
|
end
|
68
69
|
|
@@ -180,6 +181,29 @@ module Servactory
|
|
180
181
|
)
|
181
182
|
end
|
182
183
|
|
184
|
+
def add_prepare_option_with(options)
|
185
|
+
collection_of_options << Option.new(
|
186
|
+
name: :prepare,
|
187
|
+
input: self,
|
188
|
+
validation_class: nil,
|
189
|
+
define_input_methods: [
|
190
|
+
DefineInputMethod.new(
|
191
|
+
name: :prepare_present?,
|
192
|
+
content: ->(value:) { value[:in].present? }
|
193
|
+
)
|
194
|
+
],
|
195
|
+
define_input_conflicts: [
|
196
|
+
DefineInputConflict.new(content: -> { :prepare_vs_array if prepare_present? && array? }),
|
197
|
+
DefineInputConflict.new(content: -> { :prepare_vs_inclusion if prepare_present? && inclusion_present? }),
|
198
|
+
DefineInputConflict.new(content: -> { :prepare_vs_must if prepare_present? && must_present? })
|
199
|
+
],
|
200
|
+
need_for_checks: false,
|
201
|
+
value_key: :in,
|
202
|
+
value_fallback: false,
|
203
|
+
**options
|
204
|
+
)
|
205
|
+
end
|
206
|
+
|
183
207
|
def add_internal_option_with(options) # rubocop:disable Metrics/MethodLength
|
184
208
|
collection_of_options << Option.new(
|
185
209
|
name: :internal,
|
@@ -31,6 +31,9 @@ module Servactory
|
|
31
31
|
input_value = @incoming_arguments.fetch(input.name, nil)
|
32
32
|
input_value = input.default if input.optional? && input_value.blank?
|
33
33
|
|
34
|
+
input_prepare = input.prepare.fetch(:in, nil)
|
35
|
+
input_value = input_prepare.call(value: input_value) if input_prepare.present?
|
36
|
+
|
34
37
|
if input.internal?
|
35
38
|
@internal_variables[input.name] = input_value
|
36
39
|
else
|
data/lib/servactory/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: servactory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Sokolov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-06-
|
11
|
+
date: 2023-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|