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 +4 -4
- data/README.md +5 -2
- data/lib/servactory/context/dsl.rb +1 -1
- data/lib/servactory/input_arguments/tools/prepare.rb +10 -11
- data/lib/servactory/inputs.rb +4 -2
- 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: 781548f2f3cda01476bfa6570d3b1fac94890c3b86271f6bc58a32542f2d2ce9
|
4
|
+
data.tar.gz: fdddb44644b45ce539193db90e86bfefc63b3fd8140b2a54bd8654d22027191a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 :
|
97
|
+
stage { make :call }
|
97
98
|
|
98
99
|
private
|
99
100
|
|
100
|
-
def
|
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.
|
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(
|
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
|
-
|
69
|
-
|
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?
|
data/lib/servactory/inputs.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Servactory
|
4
|
-
class Inputs
|
5
|
-
|
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
|
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.4.
|
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-
|
11
|
+
date: 2023-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|