strum-service 0.0.2 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +20 -20
- data/lib/strum/service.rb +31 -8
- data/lib/strum/service/version.rb +1 -1
- data/strum-service.gemspec +4 -3
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3b57fcda6fa8662e4a8aa3184e7ae87c39dd56e51cbf11e7958dd61d041e658
|
4
|
+
data.tar.gz: 46132e5ce26025e2f38ba7d538ca1d2ebcb4f11217f9b4a6c6036c3034c5e8b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e891840754a5532e7a4c2d58116694cb38e7a12dab25e51503b72578bf7303721c870dda4a0920a08e572c640e8885fa7c7abbe7fdf1d0badf633f6fe7554893
|
7
|
+
data.tar.gz: 43fadda3c343cdedab64fb4ae4d237c184f0f4847e7525d278b4a1fc4631fb5cc97572e49aa212bce96d01cfdd82343670e10152ce781fa6ab48616edd94b0bd
|
data/Gemfile.lock
CHANGED
@@ -1,51 +1,51 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
strum-service (0.
|
4
|
+
strum-service (0.1.2)
|
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.1.1)
|
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.15.0)
|
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.5.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.5.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
@@ -13,10 +13,20 @@ module Strum
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
+
# Define coercive methods
|
17
|
+
COERCIVE_METHODS = %i[add_error add_errors any required sliced sliced_list].freeze
|
18
|
+
|
19
|
+
COERCIVE_METHODS.each do |m|
|
20
|
+
define_method("#{m}!") do |*args, **kwargs, &block|
|
21
|
+
send(m, *args, **kwargs, &block)
|
22
|
+
throw :exit unless valid?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
16
26
|
# Internal: Interactor class methods.
|
17
27
|
module ClassMethods
|
18
28
|
def call(main_input, **args, &block)
|
19
|
-
new(main_input, args).execute(&block)
|
29
|
+
new(main_input, **args).execute(&block)
|
20
30
|
end
|
21
31
|
end
|
22
32
|
|
@@ -27,12 +37,16 @@ module Strum
|
|
27
37
|
self.outputs = {}
|
28
38
|
self.inputs = args.merge(default: main_input)
|
29
39
|
self._inputs = inputs.dup.freeze
|
40
|
+
setup_default_proc
|
41
|
+
setup_input_default_proc
|
30
42
|
end
|
31
43
|
|
32
44
|
def execute
|
33
|
-
|
34
|
-
|
35
|
-
|
45
|
+
catch(:exit) do
|
46
|
+
audit
|
47
|
+
yield(self) if block_given?
|
48
|
+
call if valid?
|
49
|
+
end
|
36
50
|
valid? ? valid_result : invalid_result
|
37
51
|
end
|
38
52
|
|
@@ -61,9 +75,10 @@ module Strum
|
|
61
75
|
end
|
62
76
|
|
63
77
|
def method_missing(method_name, *args, &_block)
|
64
|
-
|
65
|
-
|
66
|
-
|
78
|
+
(args.count.zero? &&
|
79
|
+
(input.is_a?(Hash) && input[method_name.to_sym]) ||
|
80
|
+
inputs[method_name.to_sym]) ||
|
81
|
+
super
|
67
82
|
end
|
68
83
|
|
69
84
|
def respond_to_missing?(method_name, include_private = false)
|
@@ -120,7 +135,7 @@ module Strum
|
|
120
135
|
|
121
136
|
def add_error(field, value)
|
122
137
|
strum_errors[field] ||= []
|
123
|
-
strum_errors[field]
|
138
|
+
strum_errors[field] += Array(value)
|
124
139
|
end
|
125
140
|
|
126
141
|
def add_errors(errors)
|
@@ -169,6 +184,14 @@ module Strum
|
|
169
184
|
|
170
185
|
private
|
171
186
|
|
187
|
+
def setup_default_proc
|
188
|
+
inputs.default_proc = proc { |h, k| h.key?(k.to_s) ? h[k.to_s] : nil }
|
189
|
+
end
|
190
|
+
|
191
|
+
def setup_input_default_proc
|
192
|
+
input.default_proc = proc { |h, k| h.key?(k.to_s) ? h[k.to_s] : nil } if input.is_a?(Hash)
|
193
|
+
end
|
194
|
+
|
172
195
|
def key_to_sym(key)
|
173
196
|
key.to_sym
|
174
197
|
rescue StandardError
|
data/strum-service.gemspec
CHANGED
@@ -10,15 +10,16 @@ Gem::Specification.new do |spec|
|
|
10
10
|
|
11
11
|
spec.summary = "Light ruby framework"
|
12
12
|
spec.description = "Strum Service"
|
13
|
-
spec.homepage = "https://
|
13
|
+
spec.homepage = "https://gitlab.com/strum-rb/strum-service"
|
14
14
|
spec.license = "MIT"
|
15
15
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
16
16
|
|
17
17
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
18
18
|
|
19
19
|
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
-
spec.metadata["source_code_uri"] = "https://
|
21
|
-
spec.metadata["changelog_uri"] = "https://
|
20
|
+
spec.metadata["source_code_uri"] = "https://gitlab.com/strum-rb/strum-service"
|
21
|
+
spec.metadata["changelog_uri"] = "https://gitlab.com/strum-rb/strum-service/-/blob/master/CHANGELOG.md"
|
22
|
+
spec.metadata["bug_tracker_uri"] = "https://gitlab.com/strum-rb/strum-service/issues"
|
22
23
|
|
23
24
|
# Specify which files should be added to the gem when it is released.
|
24
25
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
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.
|
4
|
+
version: 0.1.2
|
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-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Strum Service
|
14
14
|
email:
|
@@ -33,14 +33,15 @@ files:
|
|
33
33
|
- lib/strum/service.rb
|
34
34
|
- lib/strum/service/version.rb
|
35
35
|
- strum-service.gemspec
|
36
|
-
homepage: https://
|
36
|
+
homepage: https://gitlab.com/strum-rb/strum-service
|
37
37
|
licenses:
|
38
38
|
- MIT
|
39
39
|
metadata:
|
40
40
|
allowed_push_host: https://rubygems.org
|
41
|
-
homepage_uri: https://
|
42
|
-
source_code_uri: https://
|
43
|
-
changelog_uri: https://
|
41
|
+
homepage_uri: https://gitlab.com/strum-rb/strum-service
|
42
|
+
source_code_uri: https://gitlab.com/strum-rb/strum-service
|
43
|
+
changelog_uri: https://gitlab.com/strum-rb/strum-service/-/blob/master/CHANGELOG.md
|
44
|
+
bug_tracker_uri: https://gitlab.com/strum-rb/strum-service/issues
|
44
45
|
post_install_message:
|
45
46
|
rdoc_options: []
|
46
47
|
require_paths:
|
@@ -56,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
57
|
- !ruby/object:Gem::Version
|
57
58
|
version: '0'
|
58
59
|
requirements: []
|
59
|
-
rubygems_version: 3.1.
|
60
|
+
rubygems_version: 3.1.6
|
60
61
|
signing_key:
|
61
62
|
specification_version: 4
|
62
63
|
summary: Light ruby framework
|