strum-service 0.1.0 → 0.2.1
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/.gitignore +3 -0
- data/Gemfile.lock +20 -20
- data/lib/strum/service.rb +22 -9
- data/lib/strum/service/version.rb +1 -1
- data/strum-service.gemspec +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: b710112b00697a5e9ffa85d91dd191518863157d9d1ad9c7263bbfb8ec37cf07
|
4
|
+
data.tar.gz: 73e87d006e34ed66f4930f12682d1a1eba0be9ec4a47e5634c76d149eda1a27f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51db6798a851873b819e433e014cc0addfc7bd45c8dab3e40c2a18d3eea8263db919f0eb82f8efd6d1d82781bf406446c4c64959cc7849a4ab95a2485f77d6f6
|
7
|
+
data.tar.gz: 3ebec9e9088617fb0c66702bd7f8514dbd2e399d646e37225002cd3de865ff084463f82367fda5e70f3cb525b456bdf1acc06c897eba205ce64967a54a9895e1
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,51 +1,51 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
strum-service (0.1
|
4
|
+
strum-service (0.2.1)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
ast (2.4.
|
9
|
+
ast (2.4.2)
|
10
10
|
diff-lcs (1.4.4)
|
11
11
|
parallel (1.20.1)
|
12
|
-
parser (
|
12
|
+
parser (3.0.2.0)
|
13
13
|
ast (~> 2.4.1)
|
14
14
|
rainbow (3.0.0)
|
15
15
|
rake (12.3.3)
|
16
|
-
regexp_parser (2.
|
17
|
-
rexml (3.2.
|
16
|
+
regexp_parser (2.1.1)
|
17
|
+
rexml (3.2.5)
|
18
18
|
rspec (3.10.0)
|
19
19
|
rspec-core (~> 3.10.0)
|
20
20
|
rspec-expectations (~> 3.10.0)
|
21
21
|
rspec-mocks (~> 3.10.0)
|
22
|
-
rspec-core (3.10.
|
22
|
+
rspec-core (3.10.1)
|
23
23
|
rspec-support (~> 3.10.0)
|
24
|
-
rspec-expectations (3.10.
|
24
|
+
rspec-expectations (3.10.1)
|
25
25
|
diff-lcs (>= 1.2.0, < 2.0)
|
26
26
|
rspec-support (~> 3.10.0)
|
27
|
-
rspec-mocks (3.10.
|
27
|
+
rspec-mocks (3.10.2)
|
28
28
|
diff-lcs (>= 1.2.0, < 2.0)
|
29
29
|
rspec-support (~> 3.10.0)
|
30
|
-
rspec-support (3.10.
|
31
|
-
rubocop (1.
|
30
|
+
rspec-support (3.10.2)
|
31
|
+
rubocop (1.18.4)
|
32
32
|
parallel (~> 1.10)
|
33
|
-
parser (>=
|
33
|
+
parser (>= 3.0.0.0)
|
34
34
|
rainbow (>= 2.2.2, < 4.0)
|
35
|
-
regexp_parser (>=
|
35
|
+
regexp_parser (>= 1.8, < 3.0)
|
36
36
|
rexml
|
37
|
-
rubocop-ast (>= 1.2.0)
|
37
|
+
rubocop-ast (>= 1.8.0, < 2.0)
|
38
38
|
ruby-progressbar (~> 1.7)
|
39
|
-
unicode-display_width (>= 1.4.0, <
|
40
|
-
rubocop-ast (1.
|
41
|
-
parser (>=
|
39
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
40
|
+
rubocop-ast (1.8.0)
|
41
|
+
parser (>= 3.0.1.1)
|
42
42
|
rubocop-rake (0.5.1)
|
43
43
|
rubocop
|
44
|
-
rubocop-rspec (2.0.
|
44
|
+
rubocop-rspec (2.0.1)
|
45
45
|
rubocop (~> 1.0)
|
46
46
|
rubocop-ast (>= 1.1.0)
|
47
|
-
ruby-progressbar (1.
|
48
|
-
unicode-display_width (
|
47
|
+
ruby-progressbar (1.11.0)
|
48
|
+
unicode-display_width (2.0.0)
|
49
49
|
|
50
50
|
PLATFORMS
|
51
51
|
ruby
|
@@ -60,4 +60,4 @@ DEPENDENCIES
|
|
60
60
|
strum-service!
|
61
61
|
|
62
62
|
BUNDLED WITH
|
63
|
-
2.
|
63
|
+
2.2.15
|
data/lib/strum/service.rb
CHANGED
@@ -25,25 +25,28 @@ module Strum
|
|
25
25
|
|
26
26
|
# Internal: Interactor class methods.
|
27
27
|
module ClassMethods
|
28
|
-
def call(main_input,
|
29
|
-
|
28
|
+
def call(main_input, args = {}, &block)
|
29
|
+
raise ArgumentError, "Only Hash are allowed for args" unless args.is_a?(Hash)
|
30
|
+
|
31
|
+
new(main_input, **args).execute(&block)
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
33
35
|
# Instance methods
|
34
|
-
def initialize(main_input,
|
36
|
+
def initialize(main_input, args = {})
|
35
37
|
self.strum_errors = {}
|
36
38
|
self.service_handlers = { on: {}, success: {}, failure: {} }
|
37
39
|
self.outputs = {}
|
38
|
-
main_input.default_proc = proc { |h, k| h.key?(k.to_s) ? h[k.to_s] : nil }
|
39
40
|
self.inputs = args.merge(default: main_input)
|
40
41
|
self._inputs = inputs.dup.freeze
|
42
|
+
setup_default_proc
|
43
|
+
setup_input_default_proc
|
41
44
|
end
|
42
45
|
|
43
|
-
def execute
|
46
|
+
def execute
|
44
47
|
catch(:exit) do
|
45
48
|
audit
|
46
|
-
|
49
|
+
yield(self) if block_given?
|
47
50
|
call if valid?
|
48
51
|
end
|
49
52
|
valid? ? valid_result : invalid_result
|
@@ -74,9 +77,11 @@ module Strum
|
|
74
77
|
end
|
75
78
|
|
76
79
|
def method_missing(method_name, *args, &_block)
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
+
if args.count.zero? && (input.is_a?(Hash) && input.keys.include?(method_name.to_sym))
|
81
|
+
input[method_name.to_sym]
|
82
|
+
else
|
83
|
+
inputs[method_name.to_sym] || super
|
84
|
+
end
|
80
85
|
end
|
81
86
|
|
82
87
|
def respond_to_missing?(method_name, include_private = false)
|
@@ -182,6 +187,14 @@ module Strum
|
|
182
187
|
|
183
188
|
private
|
184
189
|
|
190
|
+
def setup_default_proc
|
191
|
+
inputs.default_proc = proc { |h, k| h.key?(k.to_s) ? h[k.to_s] : nil }
|
192
|
+
end
|
193
|
+
|
194
|
+
def setup_input_default_proc
|
195
|
+
input.default_proc = proc { |h, k| h.key?(k.to_s) ? h[k.to_s] : nil } if input.is_a?(Hash)
|
196
|
+
end
|
197
|
+
|
185
198
|
def key_to_sym(key)
|
186
199
|
key.to_sym
|
187
200
|
rescue StandardError
|
data/strum-service.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
# Specify which files should be added to the gem when it is released.
|
25
25
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
26
26
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
27
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(
|
27
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(/^(test|spec|features|\.ruby-version)/) }
|
28
28
|
end
|
29
29
|
spec.bindir = "exe"
|
30
30
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strum-service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Serhiy Nazarov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Strum Service
|
14
14
|
email:
|