servactory 1.1.0 → 1.2.0

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
  SHA256:
3
- metadata.gz: 6ba22a3302a9dde10fcadfc2cc5777e83589e86862b8e96484ddd3ad62e78782
4
- data.tar.gz: 4fa891477fb78494b3df34bb50f3b5bea018d331471662e235d91c49d82b9e6c
3
+ metadata.gz: 9ef221cf056da7376cec0a04e0dd92ddba328f34163fe050d74e3f0158eb1e17
4
+ data.tar.gz: 2bc1b62867fb2e6c09692bfd76c315bbf739202b445fc99e46511b6dd3437c6f
5
5
  SHA512:
6
- metadata.gz: c4c5e7cbf5c7708cc468f25152086d974c1ecfee76222bade55215c4f14ee9b0b20194755338152ac21e72845e8c1358f4e185b08b6db08319c48990b5cf43ef
7
- data.tar.gz: 70c1325c6b7de415565d41f4471798d1349c0627eeca7a329b876d703500b338acb725a5bd5adc41578656488541a13690358d377799c493f8e8ba719bb1c710
6
+ metadata.gz: 126ca96b81dcbea82334b216f9b911c33282aca4c66c26d511655339cd56184ce6fac7475420184f6fcd4681d34afe210f8ebffe18e0894c635c6bcbdc045754
7
+ data.tar.gz: 22675c25495d5e2b3edfda926c5392985294c78c03e0e2d6f8930b8a8d5a7618dc94dd7cec413fba5b6ce234d23bbeea44c68cf58fc95d0e223c73c437721b43
@@ -15,7 +15,9 @@ module Servactory
15
15
 
16
16
  input_arguments_workbench.find_unnecessary!
17
17
  input_arguments_workbench.check_rules!
18
- output_arguments_workbench.find_conflicts_in!(collection_of_internal_arguments:)
18
+ output_arguments_workbench.find_conflicts_in!(
19
+ collection_of_internal_arguments: collection_of_internal_arguments
20
+ )
19
21
 
20
22
  prepare_data
21
23
 
@@ -25,7 +27,7 @@ module Servactory
25
27
 
26
28
  Servactory::Result.prepare_for(
27
29
  context: context_store.context,
28
- collection_of_output_arguments:
30
+ collection_of_output_arguments: collection_of_output_arguments
29
31
  )
30
32
  end
31
33
 
@@ -34,10 +36,10 @@ module Servactory
34
36
  attr_reader :context_store
35
37
 
36
38
  def assign_data_with(arguments)
37
- input_arguments_workbench.assign(context: context_store.context, arguments:) # 1
38
- internal_arguments_workbench.assign(context: context_store.context) # 2
39
- output_arguments_workbench.assign(context: context_store.context) # 3
40
- stage_handyman&.assign(context: context_store.context) # 4
39
+ input_arguments_workbench.assign(context: context_store.context, arguments: arguments) # 1
40
+ internal_arguments_workbench.assign(context: context_store.context) # 2
41
+ output_arguments_workbench.assign(context: context_store.context) # 3
42
+ stage_handyman&.assign(context: context_store.context) # 4
41
43
  end
42
44
 
43
45
  def prepare_data
@@ -47,10 +49,10 @@ module Servactory
47
49
  internal_arguments_workbench.prepare # 3
48
50
  end
49
51
 
50
- def configuration(&)
52
+ def configuration(&block)
51
53
  context_configuration = Servactory::Context::Configuration.new
52
54
 
53
- context_configuration.instance_eval(&)
55
+ context_configuration.instance_eval(&block)
54
56
  end
55
57
  end
56
58
  end
@@ -13,7 +13,7 @@ module Servactory
13
13
  def self.check(context:, input:, value:, check_key:, **)
14
14
  return unless should_be_checked_for?(input, check_key)
15
15
 
16
- new(context:, input:, value:).check
16
+ new(context: context, input: input, value: value).check
17
17
  end
18
18
 
19
19
  def self.should_be_checked_for?(input, check_key)
@@ -14,7 +14,7 @@ module Servactory
14
14
  def self.check(context:, input:, value:, check_key:, check_options:)
15
15
  return unless should_be_checked_for?(input, check_key)
16
16
 
17
- new(context:, input:, value:, check_options:).check
17
+ new(context: context, input: input, value: value, check_options: check_options).check
18
18
  end
19
19
 
20
20
  def self.should_be_checked_for?(input, check_key)
@@ -42,7 +42,7 @@ module Servactory
42
42
  DEFAULT_MESSAGE,
43
43
  service_class_name: @context.class.name,
44
44
  input: @input,
45
- code:
45
+ code: code
46
46
  )
47
47
  end
48
48
 
@@ -57,16 +57,15 @@ module Servactory
57
57
  return if check.call(value: @value)
58
58
 
59
59
  message.presence || DEFAULT_MESSAGE
60
- rescue StandardError => e
60
+ rescue StandardError => _e
61
61
  message_text =
62
- "[#{@context.class.name}] Syntax error inside `#{code}` of " \
63
- "`#{@input.name}` input: [#{e.class}] #{e.message}"
62
+ "[#{@context.class.name}] Syntax error inside `#{code}` of `#{@input.name}` input"
64
63
 
65
64
  add_error(
66
65
  message_text,
67
66
  service_class_name: @context.class.name,
68
67
  input: @input,
69
- code:
68
+ code: code
70
69
  )
71
70
  end
72
71
  end
@@ -17,7 +17,7 @@ module Servactory
17
17
  def self.check(context:, input:, value:, **)
18
18
  return unless should_be_checked_for?(input)
19
19
 
20
- new(context:, input:, value:).check
20
+ new(context: context, input: input, value: value).check
21
21
  end
22
22
 
23
23
  def self.should_be_checked_for?(input)
@@ -19,7 +19,7 @@ module Servactory
19
19
  def self.check(context:, input:, value:, check_key:, check_options:)
20
20
  return unless should_be_checked_for?(input, value, check_key)
21
21
 
22
- new(context:, input:, value:, types: check_options).check
22
+ new(context: context, input: input, value: value, types: check_options).check
23
23
  end
24
24
 
25
25
  def self.should_be_checked_for?(input, value, check_key)
@@ -26,12 +26,12 @@ module Servactory
26
26
 
27
27
  def options_for_checks
28
28
  {
29
- types:,
30
- inclusion:,
31
- must:,
32
- required:,
33
- # internal:,
34
- default:
29
+ types: types,
30
+ inclusion: inclusion,
31
+ must: must,
32
+ required: required,
33
+ # internal: internal,
34
+ default: default
35
35
  }
36
36
  end
37
37
 
@@ -28,13 +28,18 @@ module Servactory
28
28
 
29
29
  def process_input(input)
30
30
  input.options_for_checks.each do |check_key, check_options|
31
- process_option(check_key, check_options, input:)
31
+ process_option(check_key, check_options, input: input)
32
32
  end
33
33
  end
34
34
 
35
35
  def process_option(check_key, check_options, input:)
36
36
  check_classes.each do |check_class|
37
- errors_from_checks = process_check_class(check_class, input:, check_key:, check_options:)
37
+ errors_from_checks = process_check_class(
38
+ check_class,
39
+ input: input,
40
+ check_key: check_key,
41
+ check_options: check_options
42
+ )
38
43
 
39
44
  @errors.push(*errors_from_checks)
40
45
  end
@@ -43,10 +48,10 @@ module Servactory
43
48
  def process_check_class(check_class, input:, check_key:, check_options:)
44
49
  check_class.check(
45
50
  context: @context,
46
- input:,
51
+ input: input,
47
52
  value: @incoming_arguments.fetch(input.name, nil),
48
- check_key:,
49
- check_options:
53
+ check_key: check_key,
54
+ check_options: check_options
50
55
  )
51
56
  end
52
57
 
@@ -43,7 +43,7 @@ module Servactory
43
43
 
44
44
  @context.assign_inputs(Servactory::Inputs.new(**@inputs_variables))
45
45
 
46
- @context.class.class_eval(context_internal_variables_template)
46
+ @context.class.class_eval(context_internal_variables_template) if context_internal_variables_template.present?
47
47
 
48
48
  @internal_variables.each do |input_name, input_value|
49
49
  @context.instance_variable_set(:"@#{input_name}", input_value)
@@ -79,8 +79,12 @@ module Servactory
79
79
  # private attr_reader(*[:attr_1]);
80
80
  #
81
81
  def context_internal_variables_template
82
- <<-RUBY.squish
83
- private attr_reader(*#{@internal_variables.keys});
82
+ return if @internal_variables.blank?
83
+
84
+ @context_internal_variables_template ||= <<-RUBY.squish
85
+ private;
86
+
87
+ attr_reader(*#{@internal_variables.keys});
84
88
  RUBY
85
89
  end
86
90
  end
@@ -16,8 +16,8 @@ module Servactory
16
16
 
17
17
  def options_for_checks
18
18
  {
19
- types:,
20
- required:
19
+ types: types,
20
+ required: required
21
21
  }
22
22
  end
23
23
 
@@ -42,14 +42,16 @@ module Servactory
42
42
  define_method(:#{internal_argument.name}=) do |value|;
43
43
  Servactory::InternalArguments::Checks::Type.check!(
44
44
  context: self,
45
- internal_argument:,
46
- value:
45
+ internal_argument: internal_argument,
46
+ value: value
47
47
  );
48
48
 
49
49
  instance_variable_set(:@#{internal_argument.name}, value);
50
50
  end;
51
51
 
52
- private attr_reader :#{internal_argument.name};
52
+ private;
53
+
54
+ attr_reader :#{internal_argument.name};
53
55
  RUBY
54
56
  end
55
57
  end
@@ -18,9 +18,9 @@ module Servactory
18
18
 
19
19
  def options_for_checks
20
20
  {
21
- types:,
22
- required:,
23
- default:
21
+ types: types,
22
+ required: required,
23
+ default: default
24
24
  }
25
25
  end
26
26
 
@@ -35,21 +35,25 @@ module Servactory
35
35
  # instance_variable_set(:@user, value);
36
36
  # end;
37
37
  #
38
- # private attr_reader :user;
38
+ # private;
39
+ #
40
+ # attr_reader :user;
39
41
  #
40
42
  def context_output_argument_template_for(output_argument)
41
43
  <<-RUBY.squish
42
44
  define_method(:#{output_argument.name}=) do |value|;
43
45
  Servactory::OutputArguments::Checks::Type.check!(
44
46
  context: self,
45
- output_argument:,
46
- value:
47
+ output_argument: output_argument,
48
+ value: value
47
49
  );
48
50
 
49
51
  instance_variable_set(:@#{output_argument.name}, value);
50
52
  end;
51
53
 
52
- private attr_reader :#{output_argument.name};
54
+ private;
55
+
56
+ attr_reader :#{output_argument.name};
53
57
  RUBY
54
58
  end
55
59
  end
@@ -12,10 +12,10 @@ module Servactory
12
12
 
13
13
  attr_reader :stage_handyman
14
14
 
15
- def stage(&)
15
+ def stage(&block)
16
16
  @stage_factory ||= Factory.new
17
17
 
18
- @stage_factory.instance_eval(&)
18
+ @stage_factory.instance_eval(&block)
19
19
 
20
20
  @stage_handyman = Handyman.work_in(@stage_factory)
21
21
 
@@ -3,7 +3,7 @@
3
3
  module Servactory
4
4
  module VERSION
5
5
  MAJOR = 1
6
- MINOR = 1
6
+ MINOR = 2
7
7
  PATCH = 0
8
8
 
9
9
  STRING = [MAJOR, MINOR, PATCH].join(".")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: servactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Sokolov
@@ -223,7 +223,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
223
223
  requirements:
224
224
  - - ">="
225
225
  - !ruby/object:Gem::Version
226
- version: 3.2.0
226
+ version: 2.7.0
227
227
  required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  requirements:
229
229
  - - ">="