servactory 2.11.0 → 2.12.0.rc2
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 +4 -4
- data/config/locales/en.yml +6 -6
- data/config/locales/ru.yml +6 -6
- data/lib/servactory/configuration/option_helpers/option_helpers_collection.rb +5 -1
- data/lib/servactory/configuration/setup.rb +6 -3
- data/lib/servactory/context/warehouse/base.rb +25 -0
- data/lib/servactory/context/warehouse/inputs.rb +56 -0
- data/lib/servactory/context/warehouse/internals.rb +10 -0
- data/lib/servactory/context/warehouse/outputs.rb +12 -0
- data/lib/servactory/context/warehouse/setup.rb +73 -0
- data/lib/servactory/context/workspace/inputs.rb +3 -3
- data/lib/servactory/context/workspace/internals.rb +2 -2
- data/lib/servactory/context/workspace/outputs.rb +2 -2
- data/lib/servactory/context/workspace.rb +2 -2
- data/lib/servactory/info/builder.rb +103 -0
- data/lib/servactory/info/dsl.rb +8 -51
- data/lib/servactory/info/result.rb +4 -4
- data/lib/servactory/inputs/input.rb +8 -5
- data/lib/servactory/inputs/tools/unnecessary.rb +1 -1
- data/lib/servactory/inputs/tools/validation.rb +1 -1
- data/lib/servactory/inputs/tools/{store.rb → warehouse.rb} +2 -2
- data/lib/servactory/inputs/workspace.rb +1 -1
- data/lib/servactory/internals/internal.rb +5 -4
- data/lib/servactory/maintenance/attributes/option_helper.rb +8 -2
- data/lib/servactory/maintenance/attributes/options/registrar.rb +1 -34
- data/lib/servactory/outputs/output.rb +5 -4
- data/lib/servactory/result.rb +1 -1
- data/lib/servactory/test_kit/result.rb +3 -3
- data/lib/servactory/test_kit/rspec/matchers/have_service_attribute_matchers/consists_of_matcher.rb +20 -8
- data/lib/servactory/test_kit/rspec/matchers/have_service_attribute_matchers/inclusion_matcher.rb +23 -4
- data/lib/servactory/test_kit/rspec/matchers/have_service_input_matcher.rb +4 -1
- data/lib/servactory/test_kit/rspec/matchers/have_service_input_matchers/valid_with_matcher.rb +5 -4
- data/lib/servactory/test_kit/rspec/matchers/have_service_internal_matcher.rb +4 -1
- data/lib/servactory/tool_kit/dynamic_options/inclusion.rb +63 -0
- data/lib/servactory/tool_kit/dynamic_options/must.rb +5 -1
- data/lib/servactory/version.rb +2 -2
- metadata +12 -8
- data/lib/servactory/context/store.rb +0 -71
- data/lib/servactory/maintenance/attributes/translator/inclusion.rb +0 -26
- data/lib/servactory/maintenance/attributes/validations/inclusion.rb +0 -63
@@ -51,7 +51,7 @@ module Servactory
|
|
51
51
|
validation_class.check(
|
52
52
|
context: @context,
|
53
53
|
attribute: input,
|
54
|
-
value: @context.send(:
|
54
|
+
value: @context.send(:servactory_service_warehouse).fetch_input(input.name),
|
55
55
|
check_key:,
|
56
56
|
check_options:
|
57
57
|
)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Servactory
|
4
4
|
module Inputs
|
5
5
|
module Tools
|
6
|
-
class
|
6
|
+
class Warehouse
|
7
7
|
def self.assign(...)
|
8
8
|
new(...).assign
|
9
9
|
end
|
@@ -14,7 +14,7 @@ module Servactory
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def assign
|
17
|
-
@context.send(:
|
17
|
+
@context.send(:servactory_service_warehouse).assign_inputs(adapted_arguments)
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
@@ -8,7 +8,7 @@ module Servactory
|
|
8
8
|
def call!(incoming_arguments:, **)
|
9
9
|
super
|
10
10
|
|
11
|
-
Tools::
|
11
|
+
Tools::Warehouse.assign(self, incoming_arguments)
|
12
12
|
|
13
13
|
Tools::Unnecessary.find!(self, collection_of_inputs)
|
14
14
|
Tools::Rules.check!(self, collection_of_inputs)
|
@@ -6,12 +6,12 @@ module Servactory
|
|
6
6
|
class Actor
|
7
7
|
attr_reader :name,
|
8
8
|
:types,
|
9
|
-
:
|
9
|
+
:options
|
10
10
|
|
11
11
|
def initialize(internal)
|
12
12
|
@name = internal.name
|
13
13
|
@types = internal.types
|
14
|
-
@
|
14
|
+
@options = internal.options
|
15
15
|
|
16
16
|
define_singleton_method(:system_name) { internal.system_name }
|
17
17
|
define_singleton_method(:i18n_name) { internal.i18n_name }
|
@@ -23,7 +23,8 @@ module Servactory
|
|
23
23
|
end
|
24
24
|
|
25
25
|
attr_reader :name,
|
26
|
-
:collection_of_options
|
26
|
+
:collection_of_options,
|
27
|
+
:options
|
27
28
|
|
28
29
|
def initialize(
|
29
30
|
name,
|
@@ -64,11 +65,11 @@ module Servactory
|
|
64
65
|
features: {
|
65
66
|
types: true,
|
66
67
|
hash: true,
|
67
|
-
inclusion: true,
|
68
68
|
must: true
|
69
69
|
}
|
70
70
|
)
|
71
71
|
|
72
|
+
@options = options
|
72
73
|
@collection_of_options = options_registrar.collection
|
73
74
|
end
|
74
75
|
|
@@ -5,11 +5,17 @@ module Servactory
|
|
5
5
|
module Attributes
|
6
6
|
class OptionHelper
|
7
7
|
attr_reader :name,
|
8
|
-
:equivalent
|
8
|
+
:equivalent,
|
9
|
+
:meta
|
9
10
|
|
10
|
-
def initialize(name:, equivalent:)
|
11
|
+
def initialize(name:, equivalent:, meta: {})
|
11
12
|
@name = name
|
12
13
|
@equivalent = equivalent
|
14
|
+
@meta = meta
|
15
|
+
end
|
16
|
+
|
17
|
+
def dynamic_option?
|
18
|
+
meta[:type] == :dynamic_option
|
13
19
|
end
|
14
20
|
end
|
15
21
|
end
|
@@ -11,7 +11,6 @@ module Servactory
|
|
11
11
|
default
|
12
12
|
collection
|
13
13
|
hash
|
14
|
-
inclusion
|
15
14
|
must
|
16
15
|
prepare
|
17
16
|
].freeze
|
@@ -21,7 +20,6 @@ module Servactory
|
|
21
20
|
types: false,
|
22
21
|
default: false,
|
23
22
|
hash: false,
|
24
|
-
inclusion: false,
|
25
23
|
must: false,
|
26
24
|
prepare: false
|
27
25
|
}.freeze
|
@@ -41,7 +39,7 @@ module Servactory
|
|
41
39
|
|
42
40
|
########################################################################
|
43
41
|
|
44
|
-
def register
|
42
|
+
def register
|
45
43
|
# Validation Class: Servactory::Inputs::Validations::Required
|
46
44
|
register_required_option if @features.fetch(:required)
|
47
45
|
|
@@ -50,9 +48,6 @@ module Servactory
|
|
50
48
|
register_default_option if @features.fetch(:default)
|
51
49
|
register_hash_option if @features.fetch(:hash)
|
52
50
|
|
53
|
-
# Validation Class: Servactory::Maintenance::Attributes::Validations::Inclusion
|
54
|
-
register_inclusion_option if @features.fetch(:inclusion)
|
55
|
-
|
56
51
|
# Validation Class: Servactory::Maintenance::Attributes::Validations::Must
|
57
52
|
register_must_option if @features.fetch(:must)
|
58
53
|
|
@@ -132,11 +127,6 @@ module Servactory
|
|
132
127
|
content: ->(**) { @hash_mode_class_names.include?(@options.fetch(:type)) }
|
133
128
|
)
|
134
129
|
],
|
135
|
-
define_conflicts: [
|
136
|
-
Servactory::Maintenance::Attributes::DefineConflict.new(
|
137
|
-
content: -> { :object_vs_inclusion if @attribute.hash_mode? && @attribute.inclusion_present? }
|
138
|
-
)
|
139
|
-
],
|
140
130
|
need_for_checks: false,
|
141
131
|
body_key: :is,
|
142
132
|
body_fallback: {},
|
@@ -144,24 +134,6 @@ module Servactory
|
|
144
134
|
)
|
145
135
|
end
|
146
136
|
|
147
|
-
def register_inclusion_option # rubocop:disable Metrics/MethodLength
|
148
|
-
collection << Servactory::Maintenance::Attributes::Option.new(
|
149
|
-
name: :inclusion,
|
150
|
-
attribute: @attribute,
|
151
|
-
validation_class: Servactory::Maintenance::Attributes::Validations::Inclusion,
|
152
|
-
define_methods: [
|
153
|
-
Servactory::Maintenance::Attributes::DefineMethod.new(
|
154
|
-
name: :inclusion_present?,
|
155
|
-
content: ->(option:) { option[:in].is_a?(Array) && option[:in].present? }
|
156
|
-
)
|
157
|
-
],
|
158
|
-
need_for_checks: true,
|
159
|
-
body_key: :in,
|
160
|
-
body_fallback: nil,
|
161
|
-
**@options
|
162
|
-
)
|
163
|
-
end
|
164
|
-
|
165
137
|
def register_must_option # rubocop:disable Metrics/MethodLength
|
166
138
|
collection << Servactory::Maintenance::Attributes::Option.new(
|
167
139
|
name: :must,
|
@@ -192,11 +164,6 @@ module Servactory
|
|
192
164
|
content: ->(option:) { option[:in].present? }
|
193
165
|
)
|
194
166
|
],
|
195
|
-
define_conflicts: [
|
196
|
-
Servactory::Maintenance::Attributes::DefineConflict.new(
|
197
|
-
content: -> { :prepare_vs_inclusion if @attribute.prepare_present? && @attribute.inclusion_present? }
|
198
|
-
)
|
199
|
-
],
|
200
167
|
need_for_checks: false,
|
201
168
|
body_key: :in,
|
202
169
|
body_fallback: false,
|
@@ -6,12 +6,12 @@ module Servactory
|
|
6
6
|
class Actor
|
7
7
|
attr_reader :name,
|
8
8
|
:types,
|
9
|
-
:
|
9
|
+
:options
|
10
10
|
|
11
11
|
def initialize(output)
|
12
12
|
@name = output.name
|
13
13
|
@types = output.types
|
14
|
-
@
|
14
|
+
@options = output.options
|
15
15
|
|
16
16
|
define_singleton_method(:system_name) { output.system_name }
|
17
17
|
define_singleton_method(:i18n_name) { output.i18n_name }
|
@@ -23,7 +23,8 @@ module Servactory
|
|
23
23
|
end
|
24
24
|
|
25
25
|
attr_reader :name,
|
26
|
-
:collection_of_options
|
26
|
+
:collection_of_options,
|
27
|
+
:options
|
27
28
|
|
28
29
|
def initialize(
|
29
30
|
name,
|
@@ -64,11 +65,11 @@ module Servactory
|
|
64
65
|
features: {
|
65
66
|
types: true,
|
66
67
|
hash: true,
|
67
|
-
inclusion: true,
|
68
68
|
must: true
|
69
69
|
}
|
70
70
|
)
|
71
71
|
|
72
|
+
@options = options
|
72
73
|
@collection_of_options = options_registrar.collection
|
73
74
|
end
|
74
75
|
|
data/lib/servactory/result.rb
CHANGED
@@ -116,7 +116,7 @@ module Servactory
|
|
116
116
|
|
117
117
|
def outputs
|
118
118
|
@outputs ||= Outputs.new(
|
119
|
-
outputs: @context.send(:
|
119
|
+
outputs: @context.send(:servactory_service_warehouse).outputs,
|
120
120
|
predicate_methods_enabled: if @context.is_a?(Servactory::TestKit::Result)
|
121
121
|
true
|
122
122
|
else
|
@@ -17,7 +17,7 @@ module Servactory
|
|
17
17
|
|
18
18
|
def initialize(attributes = {})
|
19
19
|
attributes.each_pair do |name, value|
|
20
|
-
|
20
|
+
servactory_service_warehouse.assign_output(name, value)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -25,8 +25,8 @@ module Servactory
|
|
25
25
|
|
26
26
|
private
|
27
27
|
|
28
|
-
def
|
29
|
-
@
|
28
|
+
def servactory_service_warehouse
|
29
|
+
@servactory_service_warehouse ||= Servactory::Context::Warehouse::Setup.new(self)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
data/lib/servactory/test_kit/rspec/matchers/have_service_attribute_matchers/consists_of_matcher.rb
CHANGED
@@ -49,17 +49,29 @@ module Servactory
|
|
49
49
|
:custom_message,
|
50
50
|
:attribute_data
|
51
51
|
|
52
|
-
def submatcher_passes?(_subject)
|
53
|
-
|
52
|
+
def submatcher_passes?(_subject) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity
|
53
|
+
attribute_consists_of = attribute_data.fetch(:consists_of)
|
54
|
+
attribute_consists_of_types = Array(attribute_consists_of.fetch(:type))
|
55
|
+
attribute_consists_of_message = attribute_consists_of.fetch(:message)
|
54
56
|
|
55
|
-
|
57
|
+
matched = attribute_consists_of_types.difference(consists_of_types).empty? &&
|
58
|
+
consists_of_types.difference(attribute_consists_of_types).empty?
|
56
59
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
+
if custom_message.present? && !attribute_consists_of_message.nil?
|
61
|
+
if custom_message.is_a?(RSpec::Matchers::BuiltIn::BaseMatcher)
|
62
|
+
RSpec::Expectations::ValueExpectationTarget
|
63
|
+
.new(attribute_consists_of_message)
|
64
|
+
.to(custom_message)
|
65
|
+
else
|
66
|
+
matched &&= if attribute_consists_of_message.is_a?(Proc)
|
67
|
+
attribute_consists_of_message.call.casecmp(custom_message).zero?
|
68
|
+
else
|
69
|
+
attribute_consists_of_message.casecmp(custom_message).zero?
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
60
73
|
|
61
|
-
|
62
|
-
expected_keys.difference(attribute_must_keys).empty?
|
74
|
+
matched
|
63
75
|
end
|
64
76
|
|
65
77
|
def build_missing_option
|
data/lib/servactory/test_kit/rspec/matchers/have_service_attribute_matchers/inclusion_matcher.rb
CHANGED
@@ -8,12 +8,13 @@ module Servactory
|
|
8
8
|
class InclusionMatcher
|
9
9
|
attr_reader :missing_option
|
10
10
|
|
11
|
-
def initialize(described_class, attribute_type, attribute_name, values)
|
11
|
+
def initialize(described_class, attribute_type, attribute_name, values, custom_message)
|
12
12
|
@described_class = described_class
|
13
13
|
@attribute_type = attribute_type
|
14
14
|
@attribute_type_plural = attribute_type.to_s.pluralize.to_sym
|
15
15
|
@attribute_name = attribute_name
|
16
16
|
@values = values
|
17
|
+
@custom_message = custom_message
|
17
18
|
|
18
19
|
@attribute_data = described_class.info.public_send(attribute_type_plural).fetch(attribute_name)
|
19
20
|
|
@@ -41,14 +42,32 @@ module Servactory
|
|
41
42
|
:attribute_type_plural,
|
42
43
|
:attribute_name,
|
43
44
|
:values,
|
45
|
+
:custom_message,
|
44
46
|
:attribute_data
|
45
47
|
|
46
|
-
def submatcher_passes?(_subject)
|
48
|
+
def submatcher_passes?(_subject) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/PerceivedComplexity
|
47
49
|
attribute_inclusion = attribute_data.fetch(:inclusion)
|
48
50
|
attribute_inclusion_in = attribute_inclusion.fetch(:in)
|
51
|
+
attribute_inclusion_message = attribute_inclusion.fetch(:message)
|
49
52
|
|
50
|
-
attribute_inclusion_in.difference(values).empty? &&
|
51
|
-
|
53
|
+
matched = attribute_inclusion_in.difference(values).empty? &&
|
54
|
+
values.difference(attribute_inclusion_in).empty?
|
55
|
+
|
56
|
+
if custom_message.present? && !attribute_inclusion_message.nil?
|
57
|
+
if custom_message.is_a?(RSpec::Matchers::BuiltIn::BaseMatcher)
|
58
|
+
RSpec::Expectations::ValueExpectationTarget
|
59
|
+
.new(attribute_inclusion_message)
|
60
|
+
.to(custom_message)
|
61
|
+
else
|
62
|
+
matched &&= if attribute_inclusion_message.is_a?(Proc)
|
63
|
+
attribute_inclusion_message.call.casecmp(custom_message).zero?
|
64
|
+
else
|
65
|
+
attribute_inclusion_message.casecmp(custom_message).zero?
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
matched
|
52
71
|
end
|
53
72
|
|
54
73
|
def build_missing_option
|
@@ -100,12 +100,15 @@ module Servactory
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def inclusion(values)
|
103
|
+
message = block_given? ? yield : nil
|
104
|
+
|
103
105
|
add_submatcher(
|
104
106
|
HaveServiceAttributeMatchers::InclusionMatcher,
|
105
107
|
described_class,
|
106
108
|
:input,
|
107
109
|
input_name,
|
108
|
-
Array(values)
|
110
|
+
Array(values),
|
111
|
+
message
|
109
112
|
)
|
110
113
|
self
|
111
114
|
end
|
data/lib/servactory/test_kit/rspec/matchers/have_service_input_matchers/valid_with_matcher.rb
CHANGED
@@ -5,6 +5,7 @@ module Servactory
|
|
5
5
|
module Rspec
|
6
6
|
module Matchers
|
7
7
|
module HaveServiceInputMatchers
|
8
|
+
# DEPRECATED: This chain is planned to be decommissioned.
|
8
9
|
class ValidWithMatcher # rubocop:disable Metrics/ClassLength
|
9
10
|
attr_reader :missing_option
|
10
11
|
|
@@ -122,7 +123,7 @@ module Servactory
|
|
122
123
|
end
|
123
124
|
|
124
125
|
def failure_inclusion_passes? # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
125
|
-
input_inclusion_in = attribute_data.fetch(:inclusion).fetch(:in)
|
126
|
+
input_inclusion_in = attribute_data.fetch(:inclusion, {}).fetch(:in, nil)
|
126
127
|
|
127
128
|
return true if input_inclusion_in.blank?
|
128
129
|
|
@@ -135,11 +136,11 @@ module Servactory
|
|
135
136
|
|
136
137
|
if input_required_message.nil?
|
137
138
|
input_required_message = I18n.t(
|
138
|
-
"#{i18n_root_key}.#{attribute_type_plural}.validations.inclusion.
|
139
|
+
"#{i18n_root_key}.#{attribute_type_plural}.validations.must.dynamic_options.inclusion.default",
|
139
140
|
service_class_name: described_class.name,
|
140
141
|
"#{attribute_type}_name": attribute_name,
|
141
|
-
"#{attribute_type}_inclusion": input_inclusion_in,
|
142
|
-
value: wrong_value
|
142
|
+
"#{attribute_type}_inclusion": input_inclusion_in.inspect,
|
143
|
+
value: wrong_value.inspect
|
143
144
|
)
|
144
145
|
elsif input_required_message.is_a?(Proc)
|
145
146
|
service_class = Struct.new(:class_name, keyword_init: true)
|
@@ -66,12 +66,15 @@ module Servactory
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def inclusion(values)
|
69
|
+
message = block_given? ? yield : nil
|
70
|
+
|
69
71
|
add_submatcher(
|
70
72
|
HaveServiceAttributeMatchers::InclusionMatcher,
|
71
73
|
described_class,
|
72
74
|
:internal,
|
73
75
|
internal_name,
|
74
|
-
Array(values)
|
76
|
+
Array(values),
|
77
|
+
message
|
75
78
|
)
|
76
79
|
self
|
77
80
|
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Servactory
|
4
|
+
module ToolKit
|
5
|
+
module DynamicOptions
|
6
|
+
class Inclusion < Must
|
7
|
+
def self.use(option_name = :inclusion)
|
8
|
+
instance = new(option_name, :in)
|
9
|
+
instance.must(:be_inclusion)
|
10
|
+
end
|
11
|
+
|
12
|
+
def condition_for_input_with(input:, value:, option:)
|
13
|
+
if input.required? || (
|
14
|
+
input.optional? && !input.default.nil?
|
15
|
+
) || (
|
16
|
+
input.optional? && !value.nil?
|
17
|
+
) # do
|
18
|
+
return option.value.include?(value)
|
19
|
+
end
|
20
|
+
|
21
|
+
true
|
22
|
+
end
|
23
|
+
|
24
|
+
def condition_for_internal_with(value:, option:, **)
|
25
|
+
option.value.include?(value)
|
26
|
+
end
|
27
|
+
|
28
|
+
def condition_for_output_with(value:, option:, **)
|
29
|
+
option.value.include?(value)
|
30
|
+
end
|
31
|
+
|
32
|
+
########################################################################
|
33
|
+
|
34
|
+
def message_for_input_with(service:, input:, value:, option_value:, **)
|
35
|
+
service.translate(
|
36
|
+
"inputs.validations.must.dynamic_options.inclusion.default",
|
37
|
+
input_name: input.name,
|
38
|
+
value: value.inspect,
|
39
|
+
input_inclusion: option_value.inspect
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
def message_for_internal_with(service:, internal:, value:, option_value:, **)
|
44
|
+
service.translate(
|
45
|
+
"internals.validations.must.dynamic_options.inclusion.default",
|
46
|
+
internal_name: internal.name,
|
47
|
+
value: value.inspect,
|
48
|
+
internal_inclusion: option_value.inspect
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
def message_for_output_with(service:, output:, value:, option_value:, **)
|
53
|
+
service.translate(
|
54
|
+
"outputs.validations.must.dynamic_options.inclusion.default",
|
55
|
+
output_name: output.name,
|
56
|
+
value: value.inspect,
|
57
|
+
output_inclusion: option_value.inspect
|
58
|
+
)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -34,7 +34,11 @@ module Servactory
|
|
34
34
|
def must(name)
|
35
35
|
Servactory::Maintenance::Attributes::OptionHelper.new(
|
36
36
|
name: @option_name,
|
37
|
-
equivalent: equivalent_with(name)
|
37
|
+
equivalent: equivalent_with(name),
|
38
|
+
meta: {
|
39
|
+
type: :dynamic_option,
|
40
|
+
body_key: @body_key
|
41
|
+
}
|
38
42
|
)
|
39
43
|
end
|
40
44
|
|
data/lib/servactory/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: servactory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.12.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Sokolov
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-02-18 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: activesupport
|
@@ -189,14 +189,14 @@ dependencies:
|
|
189
189
|
requirements:
|
190
190
|
- - ">="
|
191
191
|
- !ruby/object:Gem::Version
|
192
|
-
version: '0.
|
192
|
+
version: '0.5'
|
193
193
|
type: :development
|
194
194
|
prerelease: false
|
195
195
|
version_requirements: !ruby/object:Gem::Requirement
|
196
196
|
requirements:
|
197
197
|
- - ">="
|
198
198
|
- !ruby/object:Gem::Version
|
199
|
-
version: '0.
|
199
|
+
version: '0.5'
|
200
200
|
- !ruby/object:Gem::Dependency
|
201
201
|
name: steep
|
202
202
|
requirement: !ruby/object:Gem::Requirement
|
@@ -249,7 +249,11 @@ files:
|
|
249
249
|
- lib/servactory/configuration/setup.rb
|
250
250
|
- lib/servactory/context/callable.rb
|
251
251
|
- lib/servactory/context/dsl.rb
|
252
|
-
- lib/servactory/context/
|
252
|
+
- lib/servactory/context/warehouse/base.rb
|
253
|
+
- lib/servactory/context/warehouse/inputs.rb
|
254
|
+
- lib/servactory/context/warehouse/internals.rb
|
255
|
+
- lib/servactory/context/warehouse/outputs.rb
|
256
|
+
- lib/servactory/context/warehouse/setup.rb
|
253
257
|
- lib/servactory/context/workspace.rb
|
254
258
|
- lib/servactory/context/workspace/inputs.rb
|
255
259
|
- lib/servactory/context/workspace/internals.rb
|
@@ -262,15 +266,16 @@ files:
|
|
262
266
|
- lib/servactory/exceptions/internal.rb
|
263
267
|
- lib/servactory/exceptions/output.rb
|
264
268
|
- lib/servactory/exceptions/success.rb
|
269
|
+
- lib/servactory/info/builder.rb
|
265
270
|
- lib/servactory/info/dsl.rb
|
266
271
|
- lib/servactory/info/result.rb
|
267
272
|
- lib/servactory/inputs/collection.rb
|
268
273
|
- lib/servactory/inputs/dsl.rb
|
269
274
|
- lib/servactory/inputs/input.rb
|
270
275
|
- lib/servactory/inputs/tools/rules.rb
|
271
|
-
- lib/servactory/inputs/tools/store.rb
|
272
276
|
- lib/servactory/inputs/tools/unnecessary.rb
|
273
277
|
- lib/servactory/inputs/tools/validation.rb
|
278
|
+
- lib/servactory/inputs/tools/warehouse.rb
|
274
279
|
- lib/servactory/inputs/translator/required.rb
|
275
280
|
- lib/servactory/inputs/validations/base.rb
|
276
281
|
- lib/servactory/inputs/validations/errors.rb
|
@@ -287,12 +292,10 @@ files:
|
|
287
292
|
- lib/servactory/maintenance/attributes/options_collection.rb
|
288
293
|
- lib/servactory/maintenance/attributes/tools/check_errors.rb
|
289
294
|
- lib/servactory/maintenance/attributes/tools/validation.rb
|
290
|
-
- lib/servactory/maintenance/attributes/translator/inclusion.rb
|
291
295
|
- lib/servactory/maintenance/attributes/translator/must.rb
|
292
296
|
- lib/servactory/maintenance/attributes/translator/type.rb
|
293
297
|
- lib/servactory/maintenance/attributes/validations/base.rb
|
294
298
|
- lib/servactory/maintenance/attributes/validations/errors.rb
|
295
|
-
- lib/servactory/maintenance/attributes/validations/inclusion.rb
|
296
299
|
- lib/servactory/maintenance/attributes/validations/must.rb
|
297
300
|
- lib/servactory/maintenance/attributes/validations/type.rb
|
298
301
|
- lib/servactory/maintenance/validations/object_schema.rb
|
@@ -318,6 +321,7 @@ files:
|
|
318
321
|
- lib/servactory/test_kit/utils/faker.rb
|
319
322
|
- lib/servactory/tool_kit/dynamic_options/consists_of.rb
|
320
323
|
- lib/servactory/tool_kit/dynamic_options/format.rb
|
324
|
+
- lib/servactory/tool_kit/dynamic_options/inclusion.rb
|
321
325
|
- lib/servactory/tool_kit/dynamic_options/max.rb
|
322
326
|
- lib/servactory/tool_kit/dynamic_options/min.rb
|
323
327
|
- lib/servactory/tool_kit/dynamic_options/multiple_of.rb
|
@@ -1,71 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Servactory
|
4
|
-
module Context
|
5
|
-
class Store
|
6
|
-
def initialize(context)
|
7
|
-
@context = context
|
8
|
-
end
|
9
|
-
|
10
|
-
def assign_inputs(arguments)
|
11
|
-
context_data[:inputs].merge!(arguments)
|
12
|
-
end
|
13
|
-
|
14
|
-
def fetch_input(name)
|
15
|
-
inputs.fetch(name, nil)
|
16
|
-
end
|
17
|
-
|
18
|
-
def assign_internal(name, value)
|
19
|
-
assign_attribute(:internals, name, value)
|
20
|
-
end
|
21
|
-
|
22
|
-
def fetch_internal(name)
|
23
|
-
internals.fetch(name, nil)
|
24
|
-
end
|
25
|
-
|
26
|
-
def assign_output(name, value)
|
27
|
-
assign_attribute(:outputs, name, value)
|
28
|
-
end
|
29
|
-
|
30
|
-
def fetch_output(name)
|
31
|
-
outputs.fetch(name, nil)
|
32
|
-
end
|
33
|
-
|
34
|
-
def inputs
|
35
|
-
@inputs ||= context_data.fetch(:inputs)
|
36
|
-
end
|
37
|
-
|
38
|
-
def internals
|
39
|
-
@internals ||= context_data.fetch(:internals)
|
40
|
-
end
|
41
|
-
|
42
|
-
def outputs
|
43
|
-
@outputs ||= context_data.fetch(:outputs)
|
44
|
-
end
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
def assign_attribute(section, name, value)
|
49
|
-
context_data[section].merge!({ name => value })
|
50
|
-
end
|
51
|
-
|
52
|
-
def context_data
|
53
|
-
@context_data ||= state.fetch(context_id)
|
54
|
-
end
|
55
|
-
|
56
|
-
def state
|
57
|
-
{
|
58
|
-
context_id => {
|
59
|
-
inputs: {},
|
60
|
-
internals: {},
|
61
|
-
outputs: {}
|
62
|
-
}
|
63
|
-
}
|
64
|
-
end
|
65
|
-
|
66
|
-
def context_id
|
67
|
-
@context_id ||= "context_#{@context.object_id}"
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Servactory
|
4
|
-
module Maintenance
|
5
|
-
module Attributes
|
6
|
-
module Translator
|
7
|
-
module Inclusion
|
8
|
-
module_function
|
9
|
-
|
10
|
-
def default_message
|
11
|
-
lambda do |service:, value:, input: nil, internal: nil, output: nil|
|
12
|
-
attribute = Servactory::Utils.define_attribute_with(input:, internal:, output:)
|
13
|
-
|
14
|
-
service.translate(
|
15
|
-
"#{attribute.i18n_name}.validations.inclusion.default_error",
|
16
|
-
"#{attribute.system_name}_name": attribute.name,
|
17
|
-
"#{attribute.system_name}_inclusion": attribute.inclusion[:in],
|
18
|
-
value:
|
19
|
-
)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|