servactory 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 40fbce39ff24b8ea522a6cbd2f2b2d48a9e09034e8cc636da53827eefb254d6f
4
- data.tar.gz: d2f56d8b47aac242932780b1969c5b47e2da961762fd7625da776ecb9966132b
3
+ metadata.gz: 781548f2f3cda01476bfa6570d3b1fac94890c3b86271f6bc58a32542f2d2ce9
4
+ data.tar.gz: fdddb44644b45ce539193db90e86bfefc63b3fd8140b2a54bd8654d22027191a
5
5
  SHA512:
6
- metadata.gz: 7ecefb0457e5933ddc441df45adb512da42f815ca1cdb23920835aa5f39ea4e73c7eeb83832bb3d128c83a94a21126e30619af325f7afe540195e2a44cdead7a
7
- data.tar.gz: 5d3772b974c1d23da5d2b75443d2a1437a0d547a8eb48f538391d66368f449f8065793f152401925a753eac4f908a6c7e02cbdbc8a0b4b019415da3ff44e89b3
6
+ metadata.gz: 60bc160221bfad63233635071ddb345f814c9ca1bdab3867cb5d3ae58835b43bca0c6a7928200a2553995bf836cfe1592d42f3dbfaa48ea97e44af8ae5eb75e2
7
+ data.tar.gz: 8a272ec82df4539946462099c9dd45857d1583b1526f74fa78d05e1a8896762e61a580bac4016ea0b78c62bb1ebf16480e9992dfadd4c99950b0938557a68f54
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  A set of tools for building reliable services of any complexity.
4
4
 
5
5
  [![Gem version](https://img.shields.io/gem/v/servactory?logo=rubygems&logoColor=fff)](https://rubygems.org/gems/servactory)
6
+ [![Release Date](https://img.shields.io/github/release-date/afuno/servactory)](https://github.com/afuno/servactory/releases)
6
7
 
7
8
  ## Contents
8
9
 
@@ -93,16 +94,18 @@ end
93
94
 
94
95
  ```ruby
95
96
  class MinimalService < ApplicationService::Base
96
- stage { make :something }
97
+ stage { make :call }
97
98
 
98
99
  private
99
100
 
100
- def something
101
+ def call
101
102
  # ...
102
103
  end
103
104
  end
104
105
  ```
105
106
 
107
+ [More examples](https://github.com/afuno/servactory/tree/main/examples/usual)
108
+
106
109
  ### Input attributes
107
110
 
108
111
  #### Isolated usage
@@ -8,7 +8,7 @@ module Servactory
8
8
  end
9
9
 
10
10
  module ClassMethods
11
- def call!(arguments) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
11
+ def call!(arguments = {}) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
12
12
  @context_store ||= Store.new(self)
13
13
 
14
14
  assign_data_with(arguments)
@@ -39,9 +39,10 @@ module Servactory
39
39
  end
40
40
 
41
41
  def create_instance_variables
42
- Servactory::Inputs.class_eval(class_inputs_template)
42
+ inputs_class = Servactory::Inputs.dup
43
+ inputs_class.class_eval(class_inputs_template) if class_inputs_template.present?
43
44
 
44
- @context.assign_inputs(Servactory::Inputs.new(**@inputs_variables))
45
+ @context.assign_inputs(inputs_class.new(**@inputs_variables))
45
46
 
46
47
  @context.class.class_eval(context_internal_variables_template) if context_internal_variables_template.present?
47
48
 
@@ -54,10 +55,6 @@ module Servactory
54
55
 
55
56
  # EXAMPLE:
56
57
  #
57
- # attr_reader(*[:attr_1]); def initialize(attr_1); @attr_1 = attr_1; end
58
- #
59
- # OR
60
- #
61
58
  # attr_reader(*[:attr_1, :attr_2, :attr_3])
62
59
  #
63
60
  # def initialize(attr_1:, attr_2:, attr_3:)
@@ -65,18 +62,20 @@ module Servactory
65
62
  # end
66
63
  #
67
64
  def class_inputs_template
68
- <<-RUBY.squish
69
- attr_reader(*#{@inputs_variables.keys});
65
+ return if @inputs_variables.blank?
66
+
67
+ @class_inputs_template ||= <<-RUBY
68
+ attr_reader(*#{@inputs_variables.keys})
70
69
 
71
- def initialize(#{@inputs_variables.keys.join(':, ')}:);
72
- #{@inputs_variables.keys.map { |key| "@#{key} = #{key}" }.join('; ')};
70
+ def initialize(#{@inputs_variables.keys.join(':, ')}:)
71
+ #{@inputs_variables.keys.map { |key| "@#{key} = #{key}" }.join('; ')}
73
72
  end
74
73
  RUBY
75
74
  end
76
75
 
77
76
  # EXAMPLE:
78
77
  #
79
- # private attr_reader(*[:attr_1]);
78
+ # private; attr_reader(*[:attr_1]);
80
79
  #
81
80
  def context_internal_variables_template
82
81
  return if @internal_variables.blank?
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Servactory
4
- class Inputs # rubocop:disable Lint/EmptyClass
5
- # NOTE: Look at the file `lib/servactory/input_arguments/tools/prepare.rb`
4
+ class Inputs
5
+ def initialize(**)
6
+ # NOTE: Look at the file `lib/servactory/input_arguments/tools/prepare.rb`
7
+ end
6
8
  end
7
9
  end
@@ -4,7 +4,7 @@ module Servactory
4
4
  module VERSION
5
5
  MAJOR = 1
6
6
  MINOR = 4
7
- PATCH = 1
7
+ PATCH = 2
8
8
 
9
9
  STRING = [MAJOR, MINOR, PATCH].join(".")
10
10
  end
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.4.1
4
+ version: 1.4.2
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-05-07 00:00:00.000000000 Z
11
+ date: 2023-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zeitwerk