servactory 2.6.3 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/config/locales/en.yml +12 -0
  3. data/config/locales/ru.yml +12 -0
  4. data/lib/servactory/actions/dsl.rb +2 -2
  5. data/lib/servactory/actions/tools/runner.rb +1 -1
  6. data/lib/servactory/configuration/setup.rb +3 -3
  7. data/lib/servactory/context/callable.rb +7 -7
  8. data/lib/servactory/context/workspace/inputs.rb +2 -2
  9. data/lib/servactory/context/workspace/internals.rb +3 -3
  10. data/lib/servactory/context/workspace/outputs.rb +3 -3
  11. data/lib/servactory/context/workspace.rb +19 -19
  12. data/lib/servactory/info/dsl.rb +3 -3
  13. data/lib/servactory/inputs/input.rb +5 -5
  14. data/lib/servactory/inputs/tools/validation.rb +7 -7
  15. data/lib/servactory/inputs/validations/required.rb +1 -1
  16. data/lib/servactory/internals/internal.rb +5 -5
  17. data/lib/servactory/maintenance/attributes/option.rb +13 -13
  18. data/lib/servactory/maintenance/attributes/tools/validation.rb +5 -5
  19. data/lib/servactory/maintenance/attributes/translator/inclusion.rb +2 -2
  20. data/lib/servactory/maintenance/attributes/translator/must.rb +8 -8
  21. data/lib/servactory/maintenance/attributes/translator/type.rb +12 -12
  22. data/lib/servactory/maintenance/attributes/validations/inclusion.rb +1 -1
  23. data/lib/servactory/maintenance/attributes/validations/must.rb +7 -7
  24. data/lib/servactory/maintenance/attributes/validations/type.rb +1 -1
  25. data/lib/servactory/maintenance/validations/object_schema.rb +11 -11
  26. data/lib/servactory/outputs/output.rb +5 -5
  27. data/lib/servactory/result.rb +4 -4
  28. data/lib/servactory/test_kit/result.rb +2 -2
  29. data/lib/servactory/test_kit/rspec/matchers/have_service_input_matchers/valid_with_matcher.rb +1 -1
  30. data/lib/servactory/tool_kit/dynamic_options/consists_of.rb +14 -13
  31. data/lib/servactory/tool_kit/dynamic_options/format.rb +11 -8
  32. data/lib/servactory/tool_kit/dynamic_options/max.rb +12 -9
  33. data/lib/servactory/tool_kit/dynamic_options/min.rb +12 -9
  34. data/lib/servactory/tool_kit/dynamic_options/multiple_of.rb +103 -0
  35. data/lib/servactory/tool_kit/dynamic_options/must.rb +16 -13
  36. data/lib/servactory/version.rb +2 -2
  37. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2a39700d311e8928abfbebb095ba075230533aef2939fd9668b8d649a257a00
4
- data.tar.gz: 4da3314f25f0f24f499c3cc9d1a6ad08dfd516b747d2df1379513894fb0fad58
3
+ metadata.gz: f0392bf65a7bdc8c133d517c581655e2a29ce4665d8a2c9dcde7eec7e1a6d1cc
4
+ data.tar.gz: 5f57c9201660ae628fb471f1bef146acb2face2aad22f10b02a0a1e2b1f9fd55
5
5
  SHA512:
6
- metadata.gz: 9f1946fa5be2ad7762cdf751e0167f58c42f45ec2fe04943c21691e614d7b2680224d008dba256878809fe348aaeea93392f9eaf3594a7a4451753be97758079
7
- data.tar.gz: 03d1c3295c54b92515b08073bba127fe5bb71529e174204b043ef428b8fd6bb1e673fc94f4f400059a50e17b845d06572601da8d137bbd570cf1a50cb07668e3
6
+ metadata.gz: f6741ccebe3ddb1f8a7b6c2908a92b5b6a3f4af00d188c5e1d2f54f663d5758ebc3956c5a0ca2efa97fed0fe97187e594557083a0cd6ca2372487430c6ca005e
7
+ data.tar.gz: e2374b66d0d8b6b3c49b07f66bc7532034957ff3985e4a776686f6c90329e2d30ed7b5f85834f12ef272a204c484689b8b6480a933256b8ec64fb274a69d58e4
@@ -30,6 +30,10 @@ en:
30
30
  default: "[%{service_class_name}] Input `%{input_name}` received value `%{value}`, which is less than `%{option_value}`"
31
31
  max:
32
32
  default: "[%{service_class_name}] Input `%{input_name}` received value `%{value}`, which is greater than `%{option_value}`"
33
+ multiple_of:
34
+ default: "[%{service_class_name}] Input `%{input_name}` has the value `%{value}`, which is not a multiple of `%{option_value}`"
35
+ blank: "[%{service_class_name}] Input `%{input_name}` has an invalid value `%{option_value}` in option `%{option_name}`"
36
+ divided_by_0: "[%{service_class_name}] Input `%{input_name}` has an invalid value `%{option_value}` in option `%{option_name}`"
33
37
  required:
34
38
  default_error:
35
39
  default: "[%{service_class_name}] Required input `%{input_name}` is missing"
@@ -66,6 +70,10 @@ en:
66
70
  default: "[%{service_class_name}] Internal attribute `%{internal_name}` received value `%{value}`, which is less than `%{option_value}`"
67
71
  max:
68
72
  default: "[%{service_class_name}] Internal attribute `%{internal_name}` received value `%{value}`, which is greater than `%{option_value}`"
73
+ multiple_of:
74
+ default: "[%{service_class_name}] Internal attribute `%{internal_name}` has the value `%{value}`, which is not a multiple of `%{option_value}`"
75
+ blank: "[%{service_class_name}] Internal attribute `%{internal_name}` has an invalid value `%{option_value}` in option `%{option_name}`"
76
+ divided_by_0: "[%{service_class_name}] Internal attribute `%{internal_name}` has an invalid value `%{option_value}` in option `%{option_name}`"
69
77
  type:
70
78
  default_error:
71
79
  default: "[%{service_class_name}] Wrong type of internal attribute `%{internal_name}`, expected `%{expected_type}`, got `%{given_type}`"
@@ -94,6 +102,10 @@ en:
94
102
  default: "[%{service_class_name}] Output attribute `%{output_name}` received value `%{value}`, which is less than `%{option_value}`"
95
103
  max:
96
104
  default: "[%{service_class_name}] Output attribute `%{output_name}` received value `%{value}`, which is greater than `%{option_value}`"
105
+ multiple_of:
106
+ default: "[%{service_class_name}] Output attribute `%{output_name}` has the value `%{value}`, which is not a multiple of `%{option_value}`"
107
+ blank: "[%{service_class_name}] Output attribute `%{output_name}` has an invalid value `%{option_value}` in option `%{option_name}`"
108
+ divided_by_0: "[%{service_class_name}] Output attribute `%{output_name}` has an invalid value `%{option_value}` in option `%{option_name}`"
97
109
  type:
98
110
  default_error:
99
111
  default: "[%{service_class_name}] Wrong type of output attribute `%{output_name}`, expected `%{expected_type}`, got `%{given_type}`"
@@ -30,6 +30,10 @@ ru:
30
30
  default: "[%{service_class_name}] Инпут `%{input_name}` получил значение `%{value}`, которое меньше `%{option_value}`"
31
31
  max:
32
32
  default: "[%{service_class_name}] Инпут `%{input_name}` получил значение `%{value}`, которое больше `%{option_value}`"
33
+ multiple_of:
34
+ default: "[%{service_class_name}] Инпут `%{input_name}` имеет значение `%{value}`, которое не кратно `%{option_value}`"
35
+ blank: "[%{service_class_name}] Инпут `%{input_name}` имеет недопустимое значение `%{option_value}` в опции `%{option_name}`"
36
+ divided_by_0: "[%{service_class_name}] Инпут `%{input_name}` имеет недопустимое значение `%{option_value}` в опции `%{option_name}`"
33
37
  required:
34
38
  default_error:
35
39
  default: "[%{service_class_name}] Обязательный инпут `%{input_name}` отсутствует"
@@ -66,6 +70,10 @@ ru:
66
70
  default: "[%{service_class_name}] Внутренний атрибут `%{internal_name}` получил значение `%{value}`, которое меньше `%{option_value}`"
67
71
  max:
68
72
  default: "[%{service_class_name}] Внутренний атрибут `%{internal_name}` получил значение `%{value}`, которое больше `%{option_value}`"
73
+ multiple_of:
74
+ default: "[%{service_class_name}] Внутренний атрибут `%{internal_name}` имеет значение `%{value}`, которое не кратно `%{option_value}`"
75
+ blank: "[%{service_class_name}] Внутренний атрибут `%{internal_name}` имеет недопустимое значение `%{option_value}` в опции `%{option_name}`"
76
+ divided_by_0: "[%{service_class_name}] Внутренний атрибут `%{internal_name}` имеет недопустимое значение `%{option_value}` в опции `%{option_name}`"
69
77
  type:
70
78
  default_error:
71
79
  default: "[%{service_class_name}] Неправильный тип внутреннего атрибута `%{internal_name}`, ожидалось `%{expected_type}`, получено `%{given_type}`"
@@ -94,6 +102,10 @@ ru:
94
102
  default: "[%{service_class_name}] Выходящий атрибут `%{output_name}` получил значение `%{value}`, которое меньше `%{option_value}`"
95
103
  max:
96
104
  default: "[%{service_class_name}] Выходящий атрибут `%{output_name}` получил значение `%{value}`, которое больше `%{option_value}`"
105
+ multiple_of:
106
+ default: "[%{service_class_name}] Выходящий атрибут `%{output_name}` имеет значение `%{value}`, которое не кратно `%{option_value}`"
107
+ blank: "[%{service_class_name}] Выходящий атрибут `%{output_name}` имеет недопустимое значение `%{option_value}` в опции `%{option_name}`"
108
+ divided_by_0: "[%{service_class_name}] Выходящий атрибут `%{output_name}` имеет недопустимое значение `%{option_value}` в опции `%{option_name}`"
97
109
  type:
98
110
  default_error:
99
111
  default: "[%{service_class_name}] Неправильный тип выходящего атрибута `%{output_name}`, ожидалось `%{expected_type}`, получено `%{given_type}`"
@@ -75,11 +75,11 @@ module Servactory
75
75
  def make(name, position: nil, **options)
76
76
  position = position.presence || next_position
77
77
 
78
- current_stage = @current_stage.presence || Stages::Stage.new(position: position)
78
+ current_stage = @current_stage.presence || Stages::Stage.new(position:)
79
79
 
80
80
  current_stage.methods << Action.new(
81
81
  name,
82
- position: position,
82
+ position:,
83
83
  **options
84
84
  )
85
85
 
@@ -96,7 +96,7 @@ module Servactory
96
96
  return if handler.nil?
97
97
 
98
98
  @context.fail!(
99
- message: handler.call(exception: exception),
99
+ message: handler.call(exception:),
100
100
  meta: {
101
101
  original_exception: exception
102
102
  }
@@ -71,19 +71,19 @@ module Servactory
71
71
  def default_input_option_helpers
72
72
  Set[
73
73
  Servactory::Maintenance::Attributes::OptionHelper.new(name: :optional, equivalent: { required: false }),
74
- Servactory::ToolKit::DynamicOptions::ConsistsOf.use(collection_mode_class_names: collection_mode_class_names)
74
+ Servactory::ToolKit::DynamicOptions::ConsistsOf.use(collection_mode_class_names:)
75
75
  ]
76
76
  end
77
77
 
78
78
  def default_internal_option_helpers
79
79
  Set[
80
- Servactory::ToolKit::DynamicOptions::ConsistsOf.use(collection_mode_class_names: collection_mode_class_names)
80
+ Servactory::ToolKit::DynamicOptions::ConsistsOf.use(collection_mode_class_names:)
81
81
  ]
82
82
  end
83
83
 
84
84
  def default_output_option_helpers
85
85
  Set[
86
- Servactory::ToolKit::DynamicOptions::ConsistsOf.use(collection_mode_class_names: collection_mode_class_names)
86
+ Servactory::ToolKit::DynamicOptions::ConsistsOf.use(collection_mode_class_names:)
87
87
  ]
88
88
  end
89
89
  end
@@ -8,7 +8,7 @@ module Servactory
8
8
 
9
9
  _call!(context, **arguments)
10
10
 
11
- config.result_class.success_for(context: context)
11
+ config.result_class.success_for(context:)
12
12
  rescue config.success_class => e
13
13
  config.result_class.success_for(context: e.context)
14
14
  end
@@ -18,11 +18,11 @@ module Servactory
18
18
 
19
19
  _call!(context, **arguments)
20
20
 
21
- config.result_class.success_for(context: context)
21
+ config.result_class.success_for(context:)
22
22
  rescue config.success_class => e
23
23
  config.result_class.success_for(context: e.context)
24
24
  rescue config.failure_class => e
25
- config.result_class.failure_for(context: context, exception: e)
25
+ config.result_class.failure_for(context:, exception: e)
26
26
  end
27
27
 
28
28
  private
@@ -31,10 +31,10 @@ module Servactory
31
31
  context.send(
32
32
  :_call!,
33
33
  incoming_arguments: arguments.symbolize_keys,
34
- collection_of_inputs: collection_of_inputs,
35
- collection_of_internals: collection_of_internals,
36
- collection_of_outputs: collection_of_outputs,
37
- collection_of_stages: collection_of_stages
34
+ collection_of_inputs:,
35
+ collection_of_internals:,
36
+ collection_of_outputs:,
37
+ collection_of_stages:
38
38
  )
39
39
  end
40
40
  end
@@ -31,7 +31,7 @@ module Servactory
31
31
 
32
32
  raise_error_for(:setter, prepared_name)
33
33
  else
34
- getter_with(name: name) { raise_error_for(:getter, name) }
34
+ getter_with(name:) { raise_error_for(:getter, name) }
35
35
  end
36
36
  end
37
37
 
@@ -82,7 +82,7 @@ module Servactory
82
82
  else
83
83
  fetch_hash_values_from(
84
84
  value: object.fetch(schema_key, {}),
85
- schema_value: schema_value,
85
+ schema_value:,
86
86
  attribute_required: schema_value.fetch(:required, true)
87
87
  )
88
88
  end
@@ -25,9 +25,9 @@ module Servactory
25
25
  if name.to_s.end_with?("=")
26
26
  prepared_name = name.to_s.delete("=").to_sym
27
27
 
28
- setter_with(prepared_name: prepared_name, value: args.pop) { raise_error_for(:setter, prepared_name) }
28
+ setter_with(prepared_name:, value: args.pop) { raise_error_for(:setter, prepared_name) }
29
29
  else
30
- getter_with(name: name) { raise_error_for(:getter, name) }
30
+ getter_with(name:) { raise_error_for(:getter, name) }
31
31
  end
32
32
  end
33
33
 
@@ -47,7 +47,7 @@ module Servactory
47
47
  Servactory::Maintenance::Attributes::Tools::Validation.validate!(
48
48
  context: @context,
49
49
  attribute: internal,
50
- value: value
50
+ value:
51
51
  )
52
52
 
53
53
  @context.send(:servactory_service_store).assign_internal(internal.name, value)
@@ -25,9 +25,9 @@ module Servactory
25
25
  if name.to_s.end_with?("=")
26
26
  prepared_name = name.to_s.delete("=").to_sym
27
27
 
28
- setter_with(prepared_name: prepared_name, value: args.pop) { raise_error_for(:setter, prepared_name) }
28
+ setter_with(prepared_name:, value: args.pop) { raise_error_for(:setter, prepared_name) }
29
29
  else
30
- getter_with(name: name) { raise_error_for(:getter, name) }
30
+ getter_with(name:) { raise_error_for(:getter, name) }
31
31
  end
32
32
  end
33
33
 
@@ -47,7 +47,7 @@ module Servactory
47
47
  Servactory::Maintenance::Attributes::Tools::Validation.validate!(
48
48
  context: @context,
49
49
  attribute: output,
50
- value: value
50
+ value:
51
51
  )
52
52
 
53
53
  @context.send(:servactory_service_store).assign_output(output.name, value)
@@ -23,22 +23,22 @@ module Servactory
23
23
  def inputs
24
24
  @inputs ||= Inputs.new(
25
25
  context: self,
26
- incoming_arguments: incoming_arguments,
27
- collection_of_inputs: collection_of_inputs
26
+ incoming_arguments:,
27
+ collection_of_inputs:
28
28
  )
29
29
  end
30
30
 
31
31
  def internals
32
32
  @internals ||= Internals.new(
33
33
  context: self,
34
- collection_of_internals: collection_of_internals
34
+ collection_of_internals:
35
35
  )
36
36
  end
37
37
 
38
38
  def outputs
39
39
  @outputs ||= Outputs.new(
40
40
  context: self,
41
- collection_of_outputs: collection_of_outputs
41
+ collection_of_outputs:
42
42
  )
43
43
  end
44
44
 
@@ -48,30 +48,30 @@ module Servactory
48
48
 
49
49
  def fail_input!(input_name, message:, meta: nil)
50
50
  raise self.class.config.input_exception_class.new(
51
- input_name: input_name,
52
- message: message,
53
- meta: meta
51
+ input_name:,
52
+ message:,
53
+ meta:
54
54
  )
55
55
  end
56
56
 
57
57
  def fail_internal!(internal_name, message:, meta: nil)
58
58
  raise self.class.config.internal_exception_class.new(
59
- internal_name: internal_name,
60
- message: message,
61
- meta: meta
59
+ internal_name:,
60
+ message:,
61
+ meta:
62
62
  )
63
63
  end
64
64
 
65
65
  def fail_output!(output_name, message:, meta: nil)
66
66
  raise self.class.config.output_exception_class.new(
67
- output_name: output_name,
68
- message: message,
69
- meta: meta
67
+ output_name:,
68
+ message:,
69
+ meta:
70
70
  )
71
71
  end
72
72
 
73
73
  def fail!(type = :base, message:, meta: nil)
74
- raise self.class.config.failure_class.new(type: type, message: message, meta: meta)
74
+ raise self.class.config.failure_class.new(type:, message:, meta:)
75
75
  end
76
76
 
77
77
  def fail_result!(service_result)
@@ -93,11 +93,11 @@ module Servactory
93
93
  collection_of_stages:
94
94
  )
95
95
  call!(
96
- incoming_arguments: incoming_arguments,
97
- collection_of_inputs: collection_of_inputs,
98
- collection_of_internals: collection_of_internals,
99
- collection_of_outputs: collection_of_outputs,
100
- collection_of_stages: collection_of_stages
96
+ incoming_arguments:,
97
+ collection_of_inputs:,
98
+ collection_of_internals:,
99
+ collection_of_outputs:,
100
+ collection_of_stages:
101
101
  )
102
102
  end
103
103
 
@@ -18,7 +18,7 @@ module Servactory
18
18
  [
19
19
  input.name,
20
20
  {
21
- actor: actor,
21
+ actor:,
22
22
  types: input.types,
23
23
  required: input.required,
24
24
  default: input.default,
@@ -36,7 +36,7 @@ module Servactory
36
36
  [
37
37
  internal.name,
38
38
  {
39
- actor: actor,
39
+ actor:,
40
40
  types: internal.types,
41
41
  inclusion: inclusion.body,
42
42
  must: must.body
@@ -52,7 +52,7 @@ module Servactory
52
52
  [
53
53
  output.name,
54
54
  {
55
- actor: actor,
55
+ actor:,
56
56
  types: output.types,
57
57
  inclusion: inclusion.body,
58
58
  must: must.body
@@ -44,12 +44,12 @@ module Servactory
44
44
  @hash_mode_class_names = hash_mode_class_names
45
45
  @option_helpers = option_helpers
46
46
 
47
- register_options(helpers: helpers, options: options)
47
+ register_options(helpers:, options:)
48
48
  end
49
49
  # rubocop:enable Style/KeywordParametersOrder
50
50
 
51
51
  def method_missing(name, *args, &block)
52
- option = @collection_of_options.find_by(name: name)
52
+ option = @collection_of_options.find_by(name:)
53
53
 
54
54
  return super if option.nil?
55
55
 
@@ -63,13 +63,13 @@ module Servactory
63
63
  def register_options(helpers:, options:) # rubocop:disable Metrics/MethodLength
64
64
  advanced_helpers = options.except(*Servactory::Maintenance::Attributes::Options::Registrar::RESERVED_OPTIONS)
65
65
 
66
- options = apply_helpers_for_options(helpers: helpers, options: options) if helpers.present?
67
- options = apply_helpers_for_options(helpers: advanced_helpers, options: options) if advanced_helpers.present?
66
+ options = apply_helpers_for_options(helpers:, options:) if helpers.present?
67
+ options = apply_helpers_for_options(helpers: advanced_helpers, options:) if advanced_helpers.present?
68
68
 
69
69
  options_registrar = Servactory::Maintenance::Attributes::Options::Registrar.register(
70
70
  attribute: self,
71
71
  hash_mode_class_names: @hash_mode_class_names,
72
- options: options,
72
+ options:,
73
73
  features: {
74
74
  required: true,
75
75
  types: true,
@@ -26,17 +26,17 @@ module Servactory
26
26
 
27
27
  def process_input(input)
28
28
  input.options_for_checks.each do |check_key, check_options|
29
- process_option(check_key, check_options, input: input)
29
+ process_option(check_key, check_options, input:)
30
30
  end
31
31
  end
32
32
 
33
33
  def process_option(check_key, check_options, input:)
34
34
  validation_classes_from(input).each do |validation_class|
35
35
  errors_from_checks = process_validation_class(
36
- validation_class: validation_class,
37
- input: input,
38
- check_key: check_key,
39
- check_options: check_options
36
+ validation_class:,
37
+ input:,
38
+ check_key:,
39
+ check_options:
40
40
  )
41
41
 
42
42
  errors.merge(errors_from_checks.to_a)
@@ -53,8 +53,8 @@ module Servactory
53
53
  context: @context,
54
54
  attribute: input,
55
55
  value: @incoming_arguments.fetch(input.name, nil),
56
- check_key: check_key,
57
- check_options: check_options
56
+ check_key:,
57
+ check_options:
58
58
  )
59
59
  end
60
60
 
@@ -7,7 +7,7 @@ module Servactory
7
7
  def self.check(context:, attribute:, value:, check_key:, **)
8
8
  return unless should_be_checked_for?(attribute, check_key)
9
9
 
10
- new(context: context, input: attribute, value: value).check
10
+ new(context:, input: attribute, value:).check
11
11
  end
12
12
 
13
13
  def self.should_be_checked_for?(input, check_key)
@@ -36,11 +36,11 @@ module Servactory
36
36
  @hash_mode_class_names = hash_mode_class_names
37
37
  @option_helpers = option_helpers
38
38
 
39
- register_options(helpers: helpers, options: options)
39
+ register_options(helpers:, options:)
40
40
  end
41
41
 
42
42
  def method_missing(name, *args, &block)
43
- option = @collection_of_options.find_by(name: name)
43
+ option = @collection_of_options.find_by(name:)
44
44
 
45
45
  return super if option.nil?
46
46
 
@@ -54,13 +54,13 @@ module Servactory
54
54
  def register_options(helpers:, options:) # rubocop:disable Metrics/MethodLength
55
55
  advanced_helpers = options.except(*Servactory::Maintenance::Attributes::Options::Registrar::RESERVED_OPTIONS)
56
56
 
57
- options = apply_helpers_for_options(helpers: helpers, options: options) if helpers.present?
58
- options = apply_helpers_for_options(helpers: advanced_helpers, options: options) if advanced_helpers.present?
57
+ options = apply_helpers_for_options(helpers:, options:) if helpers.present?
58
+ options = apply_helpers_for_options(helpers: advanced_helpers, options:) if advanced_helpers.present?
59
59
 
60
60
  options_registrar = Servactory::Maintenance::Attributes::Options::Registrar.register(
61
61
  attribute: self,
62
62
  hash_mode_class_names: @hash_mode_class_names,
63
- options: options,
63
+ options:,
64
64
  features: {
65
65
  types: true,
66
66
  hash: true,
@@ -4,7 +4,7 @@ module Servactory
4
4
  module Maintenance
5
5
  module Attributes
6
6
  class Option
7
- DEFAULT_BODY = ->(key:, body:, message: nil) { { key => body, message: message } }
7
+ DEFAULT_BODY = ->(key:, body:, message: nil) { { key => body, message: } }
8
8
 
9
9
  private_constant :DEFAULT_BODY
10
10
 
@@ -37,12 +37,12 @@ module Servactory
37
37
  @need_for_checks = need_for_checks
38
38
 
39
39
  @body = prepare_value_for(
40
- original_value: original_value,
41
- options: options,
42
- body_key: body_key,
43
- body_value: body_value,
44
- body_fallback: body_fallback,
45
- with_advanced_mode: with_advanced_mode
40
+ original_value:,
41
+ options:,
42
+ body_key:,
43
+ body_value:,
44
+ body_fallback:,
45
+ with_advanced_mode:
46
46
  )
47
47
 
48
48
  prepare_methods_for(attribute)
@@ -69,9 +69,9 @@ module Servactory
69
69
 
70
70
  prepare_advanced_for(
71
71
  body: options.fetch(@name, DEFAULT_BODY.call(key: body_key, body: body_fallback)),
72
- body_key: body_key,
73
- body_value: body_value,
74
- body_fallback: body_fallback
72
+ body_key:,
73
+ body_value:,
74
+ body_fallback:
75
75
  )
76
76
  end
77
77
 
@@ -84,18 +84,18 @@ module Servactory
84
84
  )
85
85
  if body.is_a?(Hash)
86
86
  if @name == :schema && body.fetch(body_key, nil).nil?
87
- DEFAULT_BODY.call(key: body_key, body: body)
87
+ DEFAULT_BODY.call(key: body_key, body:)
88
88
  else
89
89
  message = body.fetch(:message, nil)
90
90
 
91
91
  DEFAULT_BODY.call(
92
92
  key: body_key,
93
93
  body: body.fetch(body_key, message.present? ? body_value : body_fallback),
94
- message: message
94
+ message:
95
95
  )
96
96
  end
97
97
  else
98
- DEFAULT_BODY.call(key: body_key, body: body)
98
+ DEFAULT_BODY.call(key: body_key, body:)
99
99
  end
100
100
  end
101
101
  # rubocop:enable Metrics/MethodLength
@@ -32,9 +32,9 @@ module Servactory
32
32
  def process_option(check_key, check_options)
33
33
  validation_classes.each do |validation_class|
34
34
  errors_from_checks = process_validation_class(
35
- validation_class: validation_class,
36
- check_key: check_key,
37
- check_options: check_options
35
+ validation_class:,
36
+ check_key:,
37
+ check_options:
38
38
  )
39
39
 
40
40
  errors.merge(errors_from_checks.to_a)
@@ -50,8 +50,8 @@ module Servactory
50
50
  context: @context,
51
51
  attribute: @attribute,
52
52
  value: @value,
53
- check_key: check_key,
54
- check_options: check_options
53
+ check_key:,
54
+ check_options:
55
55
  )
56
56
  end
57
57
 
@@ -9,13 +9,13 @@ module Servactory
9
9
 
10
10
  def default_message
11
11
  lambda do |service:, value:, input: nil, internal: nil, output: nil|
12
- attribute = Servactory::Utils.define_attribute_with(input: input, internal: internal, output: output)
12
+ attribute = Servactory::Utils.define_attribute_with(input:, internal:, output:)
13
13
 
14
14
  service.translate(
15
15
  "#{attribute.i18n_name}.validations.inclusion.default_error",
16
16
  "#{attribute.system_name}_name": attribute.name,
17
17
  "#{attribute.system_name}_inclusion": attribute.inclusion[:in],
18
- value: value
18
+ value:
19
19
  )
20
20
  end
21
21
  end
@@ -9,28 +9,28 @@ module Servactory
9
9
 
10
10
  def default_message
11
11
  lambda do |service:, value:, code:, input: nil, internal: nil, output: nil, reason: nil|
12
- attribute = Servactory::Utils.define_attribute_with(input: input, internal: internal, output: output)
12
+ attribute = Servactory::Utils.define_attribute_with(input:, internal:, output:)
13
13
 
14
14
  service.translate(
15
15
  "#{attribute.i18n_name}.validations.must.default_error",
16
16
  "#{attribute.system_name}_name": attribute.name,
17
- value: value,
18
- code: code,
19
- reason: reason
17
+ value:,
18
+ code:,
19
+ reason:
20
20
  )
21
21
  end
22
22
  end
23
23
 
24
24
  def syntax_error_message
25
25
  lambda do |service:, value:, code:, exception_message:, input: nil, internal: nil, output: nil|
26
- attribute = Servactory::Utils.define_attribute_with(input: input, internal: internal, output: output)
26
+ attribute = Servactory::Utils.define_attribute_with(input:, internal:, output:)
27
27
 
28
28
  service.translate(
29
29
  "#{attribute.i18n_name}.validations.must.syntax_error",
30
30
  "#{attribute.system_name}_name": attribute.name,
31
- value: value,
32
- code: code,
33
- exception_message: exception_message
31
+ value:,
32
+ code:,
33
+ exception_message:
34
34
  )
35
35
  end
36
36
  end
@@ -10,11 +10,11 @@ module Servactory
10
10
  def default_message
11
11
  lambda do |service:, attribute:, key_name:, expected_type:, given_type:, **|
12
12
  if attribute.hash_mode? && key_name.present?
13
- for_hash_mode_with(service: service, attribute: attribute, key_name: key_name,
14
- expected_type: expected_type, given_type: given_type)
13
+ for_hash_mode_with(service:, attribute:, key_name:,
14
+ expected_type:, given_type:)
15
15
  else
16
- for_others_with(service: service, attribute: attribute,
17
- expected_type: expected_type, given_type: given_type)
16
+ for_others_with(service:, attribute:,
17
+ expected_type:, given_type:)
18
18
  end
19
19
  end
20
20
  end
@@ -27,9 +27,9 @@ module Servactory
27
27
  if hash_message.is_a?(Proc)
28
28
  hash_message.call(
29
29
  **Servactory::Utils.fetch_hash_with_desired_attribute(attribute),
30
- key_name: key_name,
31
- expected_type: expected_type,
32
- given_type: given_type
30
+ key_name:,
31
+ expected_type:,
32
+ given_type:
33
33
  )
34
34
  elsif hash_message.is_a?(String) && hash_message.present?
35
35
  hash_message
@@ -37,9 +37,9 @@ module Servactory
37
37
  service.translate(
38
38
  "#{attribute.i18n_name}.validations.type.default_error.for_hash.wrong_element_type",
39
39
  "#{attribute.system_name}_name": attribute.name,
40
- key_name: key_name,
41
- expected_type: expected_type,
42
- given_type: given_type
40
+ key_name:,
41
+ expected_type:,
42
+ given_type:
43
43
  )
44
44
  end
45
45
  end
@@ -48,8 +48,8 @@ module Servactory
48
48
  service.translate(
49
49
  "#{attribute.i18n_name}.validations.type.default_error.default",
50
50
  "#{attribute.system_name}_name": attribute.name,
51
- expected_type: expected_type,
52
- given_type: given_type
51
+ expected_type:,
52
+ given_type:
53
53
  )
54
54
  end
55
55
  end