convenient_service 0.24.0 → 0.25.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 +4 -4
- data/lib/convenient_service/dependencies/queries.rb +4 -2
- data/lib/convenient_service/extras/rspec.rb +1 -1
- data/lib/convenient_service/logger.rb +6 -3
- data/lib/convenient_service/rspec/matchers/classes/results/base/entities/printers/error/commands/generate_got_jsend_attributes_part.rb +1 -1
- data/lib/convenient_service/rspec/matchers/classes/results/base/entities/printers/failure/commands/generate_got_jsend_attributes_part.rb +1 -1
- data/lib/convenient_service/rspec/matchers/classes/results/base/entities/printers/success/commands/generate_got_jsend_attributes_part.rb +1 -1
- data/lib/convenient_service/rspec/matchers/classes/results/be_error.rb +1 -1
- data/lib/convenient_service/rspec/matchers/classes/results/be_failure.rb +1 -1
- data/lib/convenient_service/rspec/matchers/classes/results/be_not_error.rb +2 -2
- data/lib/convenient_service/rspec/matchers/classes/results/be_not_failure.rb +2 -2
- data/lib/convenient_service/rspec/matchers/classes/results/be_not_success.rb +2 -2
- data/lib/convenient_service/rspec/matchers/classes/results/be_success.rb +1 -1
- data/lib/convenient_service/service/configs/standard.rb +7 -2
- data/lib/convenient_service/service/plugins/can_have_after_step_callbacks/middleware.rb +5 -1
- data/lib/convenient_service/service/plugins/can_have_around_step_callbacks/middleware.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_before_step_callbacks/middleware.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_connected_steps/concern.rb +1 -6
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/scalar.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_inline_services/concern.rb +29 -0
- data/lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb +205 -0
- data/lib/convenient_service/service/plugins/{can_have_steps/entities/step/plugins/can_be_completed.rb → can_have_inline_services/entities.rb} +1 -1
- data/lib/convenient_service/service/plugins/can_have_inline_services/exceptions.rb +30 -0
- data/lib/convenient_service/service/plugins/can_have_inline_services.rb +36 -0
- data/lib/convenient_service/service/plugins/can_have_sequential_steps/concern.rb +2 -0
- data/lib/convenient_service/service/plugins/can_have_sequential_steps/middleware.rb +1 -5
- data/lib/convenient_service/service/plugins/can_have_steps/concern.rb +1 -6
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_factory.rb +5 -8
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/proc.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/raw.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/string.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/key.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb +13 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/{can_be_completed → can_be_evaluated}/concern.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_evaluated.rb +8 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins.rb +1 -1
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_handled_exception/concern.rb +34 -14
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_handled_exception/exceptions.rb +38 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_handled_exception.rb +1 -0
- data/lib/convenient_service/service/plugins/has_j_send_result.rb +84 -0
- data/lib/convenient_service/service/plugins.rb +1 -0
- data/lib/convenient_service/version.rb +1 -1
- data/lib/convenient_service.rb +23 -1
- metadata +9 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a077e3ef95d8ad18dbc79399c5513f29a17491111557cfad7b446eda2bec5a8
|
|
4
|
+
data.tar.gz: 07e8481191d8a8fe51b7995d5507147755ee2676cfe51b9c5a5b11e42f5a47e2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 268d3a56e8ea1e0161dde099762d3d91dcb8c85b005d2fc45e6ab9e8e622a7da15b4c6d70c45809dd8cd83787cbb042ffe71f4aaef369be4562f18d2b6b22340
|
|
7
|
+
data.tar.gz: deeb6b2c67a294a98fee2fdb409d653b4674c83c22f9e8ef413014ef42d1dfe8127e3aaecc85d020a206350607f2276e1f09575f5bb9e0888e4927a73697e513
|
|
@@ -25,10 +25,12 @@ module ConvenientService
|
|
|
25
25
|
##
|
|
26
26
|
# Returns `true` when Convenient Service is in debug mode. In other words `$CONVENIENT_SERVICE_DEBUG` env variable is set to `true`.
|
|
27
27
|
#
|
|
28
|
-
# @api
|
|
28
|
+
# @api public
|
|
29
29
|
# @since 1.0.0
|
|
30
30
|
# @return [Boolean]
|
|
31
31
|
#
|
|
32
|
+
# @see https://userdocs.convenientservice.org/comprehensive_docs/docs/the_how/how_to_debug_the_convenient_service_lib_itself.html
|
|
33
|
+
#
|
|
32
34
|
def debug?
|
|
33
35
|
::ENV["CONVENIENT_SERVICE_DEBUG"] == "true"
|
|
34
36
|
end
|
|
@@ -499,7 +501,7 @@ module ConvenientService
|
|
|
499
501
|
# @return [Boolean]
|
|
500
502
|
# @note Expected to be called from `spec_helper.rb`.
|
|
501
503
|
#
|
|
502
|
-
def
|
|
504
|
+
def require_rspec_extensions
|
|
503
505
|
require "rspec/expectations"
|
|
504
506
|
require "rspec/matchers"
|
|
505
507
|
require "rspec/mocks"
|
|
@@ -46,10 +46,10 @@ module ConvenientService
|
|
|
46
46
|
def new
|
|
47
47
|
super(::STDOUT).tap do |logger|
|
|
48
48
|
logger.level =
|
|
49
|
-
if ::ENV["
|
|
50
|
-
::Logger::DEBUG
|
|
51
|
-
elsif ::ENV["CONVENIENT_SERVICE_LOGGER_LEVEL"]
|
|
49
|
+
if ::ENV["CONVENIENT_SERVICE_LOGGER_LEVEL"]
|
|
52
50
|
::ENV["CONVENIENT_SERVICE_LOGGER_LEVEL"]
|
|
51
|
+
elsif ::ENV["CONVENIENT_SERVICE_DEBUG"] == "true"
|
|
52
|
+
::Logger::DEBUG
|
|
53
53
|
else
|
|
54
54
|
::Logger::INFO
|
|
55
55
|
end
|
|
@@ -98,6 +98,9 @@ module ConvenientService
|
|
|
98
98
|
##
|
|
99
99
|
# @api public
|
|
100
100
|
#
|
|
101
|
+
# @see https://userdocs.convenientservice.org/comprehensive_docs/docs/the_what/what_is_convenient_service_logger.html
|
|
102
|
+
# @see https://userdocs.convenientservice.org/comprehensive_docs/docs/the_how/how_to_configure_convenient_service_logger.html
|
|
103
|
+
#
|
|
101
104
|
# @internal
|
|
102
105
|
# IMPORTANT: Older versions of `Logger` do NOT support `level` as a string.
|
|
103
106
|
# - https://github.com/ruby/logger/blob/v1.2.8.1/lib/logger.rb#L333
|
|
@@ -90,7 +90,7 @@ module ConvenientService
|
|
|
90
90
|
# @return [String]
|
|
91
91
|
#
|
|
92
92
|
def code_part
|
|
93
|
-
(code == Service::Plugins::HasJSendResult
|
|
93
|
+
(code == Service::Plugins::HasJSendResult.default_error_code) ? "" : "with code `#{code}`"
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
##
|
|
@@ -90,7 +90,7 @@ module ConvenientService
|
|
|
90
90
|
# @return [String]
|
|
91
91
|
#
|
|
92
92
|
def code_part
|
|
93
|
-
(code == Service::Plugins::HasJSendResult
|
|
93
|
+
(code == Service::Plugins::HasJSendResult.default_failure_code) ? "" : "with code `#{code}`"
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
##
|
|
@@ -90,7 +90,7 @@ module ConvenientService
|
|
|
90
90
|
# @return [String]
|
|
91
91
|
#
|
|
92
92
|
def code_part
|
|
93
|
-
(code == Service::Plugins::HasJSendResult
|
|
93
|
+
(code == Service::Plugins::HasJSendResult.default_success_code) ? "" : "with code `#{code}`"
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
##
|
|
@@ -18,8 +18,8 @@ module ConvenientService
|
|
|
18
18
|
#
|
|
19
19
|
def statuses
|
|
20
20
|
[
|
|
21
|
-
Service::Plugins::HasJSendResult
|
|
22
|
-
Service::Plugins::HasJSendResult
|
|
21
|
+
Service::Plugins::HasJSendResult.success_status,
|
|
22
|
+
Service::Plugins::HasJSendResult.failure_status
|
|
23
23
|
]
|
|
24
24
|
end
|
|
25
25
|
end
|
|
@@ -18,8 +18,8 @@ module ConvenientService
|
|
|
18
18
|
#
|
|
19
19
|
def statuses
|
|
20
20
|
[
|
|
21
|
-
Service::Plugins::HasJSendResult
|
|
22
|
-
Service::Plugins::HasJSendResult
|
|
21
|
+
Service::Plugins::HasJSendResult.success_status,
|
|
22
|
+
Service::Plugins::HasJSendResult.error_status
|
|
23
23
|
]
|
|
24
24
|
end
|
|
25
25
|
end
|
|
@@ -18,8 +18,8 @@ module ConvenientService
|
|
|
18
18
|
#
|
|
19
19
|
def statuses
|
|
20
20
|
[
|
|
21
|
-
Service::Plugins::HasJSendResult
|
|
22
|
-
Service::Plugins::HasJSendResult
|
|
21
|
+
Service::Plugins::HasJSendResult.failure_status,
|
|
22
|
+
Service::Plugins::HasJSendResult.error_status
|
|
23
23
|
]
|
|
24
24
|
end
|
|
25
25
|
end
|
|
@@ -94,6 +94,7 @@ module ConvenientService
|
|
|
94
94
|
use ConvenientService::Plugins::Service::CanBeCalled::Concern if options.enabled?(:essential)
|
|
95
95
|
use ConvenientService::Plugins::Common::CanHaveCallbacks::Concern if options.enabled?(:callbacks)
|
|
96
96
|
use ConvenientService::Plugins::Service::CanHaveFallbacks::Concern if options.enabled?(:fallbacks)
|
|
97
|
+
use ConvenientService::Plugins::Service::CanHaveInlineServices::Concern if options.enabled?(:essential)
|
|
97
98
|
use ConvenientService::Plugins::Service::HasInspect::Concern if options.enabled?(:inspect)
|
|
98
99
|
use ConvenientService::Plugins::Service::HasAwesomePrintInspect::Concern if options.enabled?(:awesome_print_inspect)
|
|
99
100
|
use ConvenientService::Plugins::Service::HasAmazingPrintInspect::Concern if options.enabled?(:amazing_print_inspect)
|
|
@@ -338,7 +339,7 @@ module ConvenientService
|
|
|
338
339
|
concerns do
|
|
339
340
|
use ConvenientService::Plugins::Common::HasInternals::Concern if options.enabled?(:essential)
|
|
340
341
|
use ConvenientService::Plugins::Step::HasResult::Concern if options.enabled?(:essential)
|
|
341
|
-
use ConvenientService::Plugins::Step::
|
|
342
|
+
use ConvenientService::Plugins::Step::CanBeEvaluated::Concern if options.enabled?(:essential)
|
|
342
343
|
use ConvenientService::Plugins::Step::CanBeServiceStep::Concern if options.enabled?(:essential)
|
|
343
344
|
use ConvenientService::Plugins::Step::CanBeMethodStep::Concern if options.enabled?(:essential)
|
|
344
345
|
use ConvenientService::Plugins::Step::CanBeUsedInServiceAwareEnumerables::Concern if options.enabled?(:essential)
|
|
@@ -352,7 +353,6 @@ module ConvenientService
|
|
|
352
353
|
|
|
353
354
|
middlewares :result do
|
|
354
355
|
use ConvenientService::Plugins::Common::CachesReturnValue::Middleware if options.enabled?(:per_instance_caching)
|
|
355
|
-
use ConvenientService::Plugins::Common::CanHaveCallbacks::Middleware if options.enabled?(:callbacks)
|
|
356
356
|
use ConvenientService::Plugins::Step::HasResult::Middleware if options.enabled?(:essential)
|
|
357
357
|
use ConvenientService::Plugins::Step::CanHaveParentResult::Middleware if options.enabled?(:result_parents_trace)
|
|
358
358
|
use ConvenientService::Plugins::Step::CanHaveFallbacks::Middleware.with(fallback_true_status: :failure) if options.enabled?(:fallbacks)
|
|
@@ -369,6 +369,11 @@ module ConvenientService
|
|
|
369
369
|
use ConvenientService::Plugins::Common::CachesReturnValue::Middleware if options.enabled?(:per_instance_caching)
|
|
370
370
|
end
|
|
371
371
|
|
|
372
|
+
middlewares :organizer_result do
|
|
373
|
+
use ConvenientService::Plugins::Common::CachesReturnValue::Middleware if options.enabled?(:per_instance_caching)
|
|
374
|
+
use ConvenientService::Plugins::Common::CanHaveCallbacks::Middleware if options.enabled?(:callbacks)
|
|
375
|
+
end
|
|
376
|
+
|
|
372
377
|
entity :Internals do
|
|
373
378
|
concerns do
|
|
374
379
|
use ConvenientService::Plugins::Internals::HasCache::Concern if options.enabled?(:per_instance_caching)
|
|
@@ -65,11 +65,15 @@ module ConvenientService
|
|
|
65
65
|
# end
|
|
66
66
|
# end
|
|
67
67
|
#
|
|
68
|
+
# @internal
|
|
69
|
+
# IMPORTANT: `result.step.result` does NOT take result from internal cache, it raises instead. That is frustrating to the end-users, but there is NO workaroud yet.
|
|
70
|
+
# TODO: Think about passing `result` with `callback_arguments`. Not perfect, but better than nothing.
|
|
71
|
+
#
|
|
68
72
|
def next(method, **kwargs, &block)
|
|
69
73
|
return chain.next(method, **kwargs, &block) if method != :step
|
|
70
74
|
|
|
71
75
|
entity.step_class.class_exec(kwargs, block) do |kwargs, block|
|
|
72
|
-
after :
|
|
76
|
+
after :organizer_result, **kwargs.merge(source_location: block.source_location) do |result|
|
|
73
77
|
organizer.instance_exec(
|
|
74
78
|
result.step,
|
|
75
79
|
params.to_callback_arguments,
|
|
@@ -73,7 +73,7 @@ module ConvenientService
|
|
|
73
73
|
return chain.next(method, **kwargs, &block) if method != :step
|
|
74
74
|
|
|
75
75
|
entity.step_class.class_exec(kwargs, block) do |kwargs, block|
|
|
76
|
-
around :
|
|
76
|
+
around :organizer_result, **kwargs.merge(source_location: block.source_location) do |chain|
|
|
77
77
|
organizer.instance_exec(
|
|
78
78
|
proc { chain.yield.step },
|
|
79
79
|
params.to_callback_arguments,
|
|
@@ -69,7 +69,7 @@ module ConvenientService
|
|
|
69
69
|
return chain.next(method, **kwargs, &block) if method != :step
|
|
70
70
|
|
|
71
71
|
entity.step_class.class_exec(kwargs, block) do |kwargs, block|
|
|
72
|
-
before :
|
|
72
|
+
before :organizer_result, **kwargs.merge(source_location: block.source_location) do
|
|
73
73
|
organizer.instance_exec(
|
|
74
74
|
params.to_callback_arguments,
|
|
75
75
|
&block
|
|
@@ -23,6 +23,7 @@ module ConvenientService
|
|
|
23
23
|
# @return [ConvenientService::Service::Plugins::CanHaveConnectedSteps::Entities::Expressions::Base]
|
|
24
24
|
#
|
|
25
25
|
# @note It is NOT recommended to rely on the return value of this method, since it may differ across different `step` related plugins.
|
|
26
|
+
# @see https://userdocs.convenientservice.org/comprehensive_docs/docs/the_what/what_step_input_types_are_available.html
|
|
26
27
|
#
|
|
27
28
|
def step(*args, **kwargs)
|
|
28
29
|
previous_expression = steps.expression
|
|
@@ -717,12 +718,6 @@ module ConvenientService
|
|
|
717
718
|
def steps_result
|
|
718
719
|
::ConvenientService.raise Exceptions::ServiceHasNoSteps.new(service_class: self.class) if steps.none?
|
|
719
720
|
|
|
720
|
-
steps.each_evaluated_step do |step|
|
|
721
|
-
step.save_outputs_in_organizer!
|
|
722
|
-
|
|
723
|
-
step.mark_as_evaluated!
|
|
724
|
-
end
|
|
725
|
-
|
|
726
721
|
steps.result
|
|
727
722
|
end
|
|
728
723
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# @author Marian Kostyk <mariankostyk13895@gmail.com>
|
|
5
|
+
# @license LGPLv3 <https://www.gnu.org/licenses/lgpl-3.0.html>
|
|
6
|
+
##
|
|
7
|
+
|
|
8
|
+
module ConvenientService
|
|
9
|
+
module Service
|
|
10
|
+
module Plugins
|
|
11
|
+
module CanHaveInlineServices
|
|
12
|
+
module Concern
|
|
13
|
+
include Support::Concern
|
|
14
|
+
|
|
15
|
+
instance_methods do
|
|
16
|
+
##
|
|
17
|
+
# @api private
|
|
18
|
+
# @param block [Proc, nil]
|
|
19
|
+
# @return [ConvenientService::Service::Plugins::CanHaveInlineServices::Entities::Proxy]
|
|
20
|
+
#
|
|
21
|
+
def inline(&block)
|
|
22
|
+
Entities::Proxy.new(&block)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# @author Marian Kostyk <mariankostyk13895@gmail.com>
|
|
5
|
+
# @license LGPLv3 <https://www.gnu.org/licenses/lgpl-3.0.html>
|
|
6
|
+
##
|
|
7
|
+
|
|
8
|
+
module ConvenientService
|
|
9
|
+
module Service
|
|
10
|
+
module Plugins
|
|
11
|
+
module CanHaveInlineServices
|
|
12
|
+
module Entities
|
|
13
|
+
##
|
|
14
|
+
# @internal
|
|
15
|
+
# TODO: Specs.
|
|
16
|
+
#
|
|
17
|
+
class Proxy
|
|
18
|
+
##
|
|
19
|
+
# @param chain [Hash{Symbol => Object}]
|
|
20
|
+
# @param block [Proc, nil]
|
|
21
|
+
# @return [void]
|
|
22
|
+
#
|
|
23
|
+
def initialize(chain: {}, &block)
|
|
24
|
+
@chain = chain
|
|
25
|
+
|
|
26
|
+
if block
|
|
27
|
+
chain[:block] = block
|
|
28
|
+
|
|
29
|
+
define
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
##
|
|
34
|
+
# @return [Boolean]
|
|
35
|
+
#
|
|
36
|
+
def defined?
|
|
37
|
+
chain.has_key?(:defined)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
##
|
|
41
|
+
# @return [Boolean]
|
|
42
|
+
#
|
|
43
|
+
def define
|
|
44
|
+
return false if self.defined?
|
|
45
|
+
|
|
46
|
+
klass.include config
|
|
47
|
+
|
|
48
|
+
variables.each_pair { |key, value| klass.define_method(key) { value } }
|
|
49
|
+
|
|
50
|
+
klass.class_exec(arguments, &block)
|
|
51
|
+
|
|
52
|
+
mark_as_defined!
|
|
53
|
+
|
|
54
|
+
true
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
##
|
|
58
|
+
# @return [ConvenientService::Service::Plugins::CanHaveInlineServices::Entities::Proxy]
|
|
59
|
+
#
|
|
60
|
+
def with_arguments(...)
|
|
61
|
+
assert_not_defined!
|
|
62
|
+
|
|
63
|
+
chain[:arguments] = Support::Arguments.new(...)
|
|
64
|
+
|
|
65
|
+
self
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
##
|
|
69
|
+
# @param variables [Hash{Symbol => Object}]
|
|
70
|
+
# @return [ConvenientService::Service::Plugins::CanHaveInlineServices::Entities::Proxy]
|
|
71
|
+
#
|
|
72
|
+
def with_variables(**variables)
|
|
73
|
+
assert_not_defined!
|
|
74
|
+
|
|
75
|
+
chain[:variables] = variables
|
|
76
|
+
|
|
77
|
+
self
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
##
|
|
81
|
+
# @param config [ConvenientService::Config]
|
|
82
|
+
# @return [ConvenientService::Service::Plugins::CanHaveInlineServices::Entities::Proxy]
|
|
83
|
+
#
|
|
84
|
+
def with_config(config)
|
|
85
|
+
assert_not_defined!
|
|
86
|
+
|
|
87
|
+
chain[:config] = config
|
|
88
|
+
|
|
89
|
+
self
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
##
|
|
93
|
+
# @param block [Proc, nil]
|
|
94
|
+
# @return [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result]
|
|
95
|
+
#
|
|
96
|
+
def result(&block)
|
|
97
|
+
if block
|
|
98
|
+
assert_not_defined!
|
|
99
|
+
|
|
100
|
+
chain[:block] = block
|
|
101
|
+
|
|
102
|
+
define
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
klass.result
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
##
|
|
109
|
+
# @param block [Proc, nil]
|
|
110
|
+
# @return [Class<ConvenientService::Service>]
|
|
111
|
+
#
|
|
112
|
+
def to_class(&block)
|
|
113
|
+
if block
|
|
114
|
+
assert_not_defined!
|
|
115
|
+
|
|
116
|
+
chain[:block] = block
|
|
117
|
+
|
|
118
|
+
define
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
klass
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
##
|
|
125
|
+
# @return [Class<ConvenientService::Service>]
|
|
126
|
+
#
|
|
127
|
+
alias_method :service, :to_class
|
|
128
|
+
|
|
129
|
+
##
|
|
130
|
+
# @param other [Object] Can be any type.
|
|
131
|
+
# @return [Boolean, nil]
|
|
132
|
+
#
|
|
133
|
+
def ==(other)
|
|
134
|
+
return unless other.instance_of?(self.class)
|
|
135
|
+
|
|
136
|
+
return false if chain != other.chain
|
|
137
|
+
|
|
138
|
+
true
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
protected
|
|
142
|
+
|
|
143
|
+
##
|
|
144
|
+
# @!attribute [r] value
|
|
145
|
+
# @return [Hash{Symbol => Object}]
|
|
146
|
+
#
|
|
147
|
+
attr_reader :chain
|
|
148
|
+
|
|
149
|
+
private
|
|
150
|
+
|
|
151
|
+
##
|
|
152
|
+
# @return [Class]
|
|
153
|
+
#
|
|
154
|
+
def klass
|
|
155
|
+
@klass ||= ::Class.new
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
##
|
|
159
|
+
# @return [ConvenientService::Support::Arguments]
|
|
160
|
+
#
|
|
161
|
+
def arguments
|
|
162
|
+
chain[:arguments] || Support::Arguments.null_arguments
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
##
|
|
166
|
+
# @return [Hash{Symbol => Object}]
|
|
167
|
+
#
|
|
168
|
+
def variables
|
|
169
|
+
chain[:variables] || {}
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
##
|
|
173
|
+
# @return [ConvenientService::Config]
|
|
174
|
+
#
|
|
175
|
+
def config
|
|
176
|
+
chain[:config] || ::ConvenientService::Standard::Config
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
##
|
|
180
|
+
# @return [Proc]
|
|
181
|
+
#
|
|
182
|
+
def block
|
|
183
|
+
chain[:block] || proc {}
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
##
|
|
187
|
+
# @return [void]
|
|
188
|
+
# @raise [ConvenientService::Service::Plugins::CanHaveInlineServices::Exceptions::InlineServiceIsAlreadyDefined]
|
|
189
|
+
#
|
|
190
|
+
def assert_not_defined!
|
|
191
|
+
::ConvenientService.raise Exceptions::InlineServiceIsAlreadyDefined if self.defined?
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
##
|
|
195
|
+
# @return [void]
|
|
196
|
+
#
|
|
197
|
+
def mark_as_defined!
|
|
198
|
+
chain[:defined] = true
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# @author Marian Kostyk <mariankostyk13895@gmail.com>
|
|
5
|
+
# @license LGPLv3 <https://www.gnu.org/licenses/lgpl-3.0.html>
|
|
6
|
+
##
|
|
7
|
+
|
|
8
|
+
module ConvenientService
|
|
9
|
+
module Service
|
|
10
|
+
module Plugins
|
|
11
|
+
module CanHaveInlineServices
|
|
12
|
+
module Exceptions
|
|
13
|
+
class InlineServiceIsAlreadyDefined < ::ConvenientService::Exception
|
|
14
|
+
##
|
|
15
|
+
# @param object [Object] Can be any type.
|
|
16
|
+
# @return [void]
|
|
17
|
+
#
|
|
18
|
+
def initialize_with_kwargs(object:)
|
|
19
|
+
message = <<~TEXT
|
|
20
|
+
Definition of already defined inline service can NOT be modified.
|
|
21
|
+
TEXT
|
|
22
|
+
|
|
23
|
+
initialize(message)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# @author Marian Kostyk <mariankostyk13895@gmail.com>
|
|
5
|
+
# @license LGPLv3 <https://www.gnu.org/licenses/lgpl-3.0.html>
|
|
6
|
+
##
|
|
7
|
+
|
|
8
|
+
require_relative "can_have_inline_services/concern"
|
|
9
|
+
require_relative "can_have_inline_services/entities"
|
|
10
|
+
require_relative "can_have_inline_services/exceptions"
|
|
11
|
+
|
|
12
|
+
# frozen_string_literal: true
|
|
13
|
+
|
|
14
|
+
##
|
|
15
|
+
# @author Marian Kostyk <mariankostyk13895@gmail.com>
|
|
16
|
+
# @license LGPLv3 <https://www.gnu.org/licenses/lgpl-3.0.html>
|
|
17
|
+
##
|
|
18
|
+
|
|
19
|
+
module ConvenientService
|
|
20
|
+
module Service
|
|
21
|
+
module Plugins
|
|
22
|
+
module CanHaveInlineServices
|
|
23
|
+
class << self
|
|
24
|
+
##
|
|
25
|
+
# @api private
|
|
26
|
+
# @param block [Proc, nil]
|
|
27
|
+
# @return [ConvenientService::Service::Plugins::CanHaveInlineServices::Entities::Proxy]
|
|
28
|
+
#
|
|
29
|
+
def proxy(&block)
|
|
30
|
+
Entities::Proxy.new(&block)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -22,6 +22,8 @@ module ConvenientService
|
|
|
22
22
|
# @param kwargs [Hash{Symbol => Object}]
|
|
23
23
|
# @return [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Step]
|
|
24
24
|
#
|
|
25
|
+
# @see https://userdocs.convenientservice.org/comprehensive_docs/docs/best_practices/declare_in_out_explicitly_on_method_steps.html
|
|
26
|
+
#
|
|
25
27
|
def step(*args, **kwargs)
|
|
26
28
|
steps.create(*args, **kwargs)
|
|
27
29
|
end
|
|
@@ -52,11 +52,7 @@ module ConvenientService
|
|
|
52
52
|
# Do NOT spend too much time on that again, you have a lot of other tasks to do.
|
|
53
53
|
#
|
|
54
54
|
def find_first_not_successful_step_with_side_effects_during_lookup
|
|
55
|
-
entity.steps.find
|
|
56
|
-
step.status.unsafe_not_success?
|
|
57
|
-
.tap { step.save_outputs_in_organizer! }
|
|
58
|
-
.tap { step.mark_as_evaluated! }
|
|
59
|
-
end
|
|
55
|
+
entity.steps.find { |step| step.organizer_result.status.unsafe_not_success? }
|
|
60
56
|
end
|
|
61
57
|
|
|
62
58
|
##
|
|
@@ -24,13 +24,8 @@ module ConvenientService
|
|
|
24
24
|
##
|
|
25
25
|
# @api public
|
|
26
26
|
#
|
|
27
|
-
# Allows to pass a value to `in` method without its intermediate processing.
|
|
28
27
|
# @see https://userdocs.convenientservice.org/basics/step_to_result_translation_table
|
|
29
|
-
#
|
|
30
|
-
# @example `:chat_v2` is passed to `AssertFeatureEnabled` as it is.
|
|
31
|
-
# step AssertFeatureEnabled, in: {name: raw(:chat_v2)}
|
|
32
|
-
# # that is converted to the following service invocation:
|
|
33
|
-
# AssertFeatureEnabled.result(name: :chat_v2)
|
|
28
|
+
# @see https://userdocs.convenientservice.org/comprehensive_docs/docs/the_what/what_is_a_step_raw_input.html
|
|
34
29
|
#
|
|
35
30
|
# @param value [Object] Can be any type.
|
|
36
31
|
# @return [ConvenientService::Support::RawValue]
|
|
@@ -27,7 +27,7 @@ module ConvenientService
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
##
|
|
30
|
-
# @return [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Entities::
|
|
30
|
+
# @return [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Entities::Factories::Base, nil]
|
|
31
31
|
#
|
|
32
32
|
def call
|
|
33
33
|
return unless factory_class
|
|
@@ -59,28 +59,25 @@ module ConvenientService
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
##
|
|
62
|
-
# @return [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Entities::
|
|
62
|
+
# @return [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Entities::Factories::Base, nil]
|
|
63
63
|
#
|
|
64
64
|
def cast_symbol
|
|
65
65
|
Entities::Factories::Symbol
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
##
|
|
69
|
-
# @return [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Entities::
|
|
69
|
+
# @return [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Entities::Factories::Base, nil]
|
|
70
70
|
#
|
|
71
71
|
def cast_string
|
|
72
72
|
Entities::Factories::String
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
##
|
|
76
|
-
# @return [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Entities::
|
|
76
|
+
# @return [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Entities::Factories::Base, nil]
|
|
77
77
|
#
|
|
78
78
|
def cast_hash
|
|
79
79
|
return unless other.keys.one?
|
|
80
80
|
|
|
81
|
-
##
|
|
82
|
-
# TODO: Add `other.keys.first.is_a?(Integer)` and `other.keys.first == Support::BLOCK` to support args and block via `step`?
|
|
83
|
-
#
|
|
84
81
|
value = other.values.first
|
|
85
82
|
|
|
86
83
|
case value
|
|
@@ -96,7 +93,7 @@ module ConvenientService
|
|
|
96
93
|
end
|
|
97
94
|
|
|
98
95
|
##
|
|
99
|
-
# @return [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Entities::
|
|
96
|
+
# @return [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Entities::Factories::Base, nil]
|
|
100
97
|
#
|
|
101
98
|
def cast_method
|
|
102
99
|
Entities::Factories::Method
|
data/lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb
CHANGED
|
@@ -174,6 +174,19 @@ module ConvenientService
|
|
|
174
174
|
@organizer
|
|
175
175
|
end
|
|
176
176
|
|
|
177
|
+
##
|
|
178
|
+
# @return [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result]
|
|
179
|
+
#
|
|
180
|
+
def organizer_result
|
|
181
|
+
original_result = result
|
|
182
|
+
|
|
183
|
+
save_outputs_in_organizer!
|
|
184
|
+
|
|
185
|
+
mark_as_evaluated!
|
|
186
|
+
|
|
187
|
+
original_result
|
|
188
|
+
end
|
|
189
|
+
|
|
177
190
|
##
|
|
178
191
|
# @api public
|
|
179
192
|
#
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
require_relative "plugins/has_result"
|
|
9
9
|
|
|
10
|
-
require_relative "plugins/
|
|
10
|
+
require_relative "plugins/can_be_evaluated"
|
|
11
11
|
require_relative "plugins/can_be_service_step"
|
|
12
12
|
require_relative "plugins/can_be_method_step"
|
|
13
13
|
require_relative "plugins/can_be_used_in_service_aware_enumerables"
|
|
@@ -35,20 +35,40 @@ module ConvenientService
|
|
|
35
35
|
extra_kwargs.dig(:exceptions, :handled)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
def from_exception(exception, **kwargs)
|
|
39
|
+
::ConvenientService.raise Exceptions::FromExceptionOnNotErrorResult.new(result: self) unless status.unsafe_error?
|
|
40
|
+
data =
|
|
41
|
+
if Service::Plugins::HasJSendResult.default_error_data == unsafe_data.to_h
|
|
42
|
+
{handled_exception: exception}
|
|
43
|
+
else
|
|
44
|
+
unsafe_data
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
message =
|
|
48
|
+
if Service::Plugins::HasJSendResult.default_error_message == unsafe_message.to_s
|
|
49
|
+
Service::Plugins::CanHaveFormattedExceptions.format_exception(exception, **kwargs)
|
|
50
|
+
else
|
|
51
|
+
unsafe_message
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
code =
|
|
55
|
+
if Service::Plugins::HasJSendResult.default_error_code == unsafe_code.to_sym
|
|
56
|
+
:handled_exception
|
|
57
|
+
else
|
|
58
|
+
unsafe_code
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
copy(
|
|
62
|
+
overrides: {
|
|
63
|
+
kwargs: {
|
|
64
|
+
data: data,
|
|
65
|
+
message: message,
|
|
66
|
+
code: code,
|
|
67
|
+
exceptions: {handled: exception}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
end
|
|
52
72
|
end
|
|
53
73
|
end
|
|
54
74
|
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# @author Marian Kostyk <mariankostyk13895@gmail.com>
|
|
5
|
+
# @license LGPLv3 <https://www.gnu.org/licenses/lgpl-3.0.html>
|
|
6
|
+
##
|
|
7
|
+
|
|
8
|
+
module ConvenientService
|
|
9
|
+
module Service
|
|
10
|
+
module Plugins
|
|
11
|
+
module HasJSendResult
|
|
12
|
+
module Entities
|
|
13
|
+
class Result
|
|
14
|
+
module Plugins
|
|
15
|
+
module CanBeFromHandledException
|
|
16
|
+
module Exceptions
|
|
17
|
+
class FromExceptionOnNotErrorResult < ::ConvenientService::Exception
|
|
18
|
+
##
|
|
19
|
+
# @param result [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result]
|
|
20
|
+
# @return [void]
|
|
21
|
+
#
|
|
22
|
+
def initialize_with_kwargs(result:)
|
|
23
|
+
message = <<~TEXT
|
|
24
|
+
`#{result.status}(...).from_exception(exception, ...)` is NOT allowed. Only `error` results can be from exceptions.
|
|
25
|
+
TEXT
|
|
26
|
+
|
|
27
|
+
initialize(message)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -14,6 +14,90 @@ module ConvenientService
|
|
|
14
14
|
module Plugins
|
|
15
15
|
module HasJSendResult
|
|
16
16
|
class << self
|
|
17
|
+
##
|
|
18
|
+
# @return [Symbol]
|
|
19
|
+
#
|
|
20
|
+
def success_status
|
|
21
|
+
Constants::SUCCESS_STATUS
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
##
|
|
25
|
+
# @return [Symbol]
|
|
26
|
+
#
|
|
27
|
+
def failure_status
|
|
28
|
+
Constants::FAILURE_STATUS
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
##
|
|
32
|
+
# @return [Symbol]
|
|
33
|
+
#
|
|
34
|
+
def error_status
|
|
35
|
+
Constants::ERROR_STATUS
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
##
|
|
39
|
+
# @return [Hash{Symbol => Object}]
|
|
40
|
+
#
|
|
41
|
+
def default_success_data
|
|
42
|
+
Constants::DEFAULT_SUCCESS_DATA
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
##
|
|
46
|
+
# @return [Hash{Symbol => Object}]
|
|
47
|
+
#
|
|
48
|
+
def default_failure_data
|
|
49
|
+
Constants::DEFAULT_FAILURE_DATA
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
##
|
|
53
|
+
# @return [Hash{Symbol => Object}]
|
|
54
|
+
#
|
|
55
|
+
def default_error_data
|
|
56
|
+
Constants::DEFAULT_ERROR_DATA
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
##
|
|
60
|
+
# @return [String]
|
|
61
|
+
#
|
|
62
|
+
def default_success_message
|
|
63
|
+
Constants::DEFAULT_SUCCESS_MESSAGE
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
##
|
|
67
|
+
# @return [String]
|
|
68
|
+
#
|
|
69
|
+
def default_failure_message
|
|
70
|
+
Constants::DEFAULT_FAILURE_MESSAGE
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
##
|
|
74
|
+
# @return [String]
|
|
75
|
+
#
|
|
76
|
+
def default_error_message
|
|
77
|
+
Constants::DEFAULT_ERROR_MESSAGE
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
##
|
|
81
|
+
# @return [Symbol]
|
|
82
|
+
#
|
|
83
|
+
def default_success_code
|
|
84
|
+
Constants::DEFAULT_SUCCESS_CODE
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
##
|
|
88
|
+
# @return [Symbol]
|
|
89
|
+
#
|
|
90
|
+
def default_failure_code
|
|
91
|
+
Constants::DEFAULT_FAILURE_CODE
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
##
|
|
95
|
+
# @return [Symbol]
|
|
96
|
+
#
|
|
97
|
+
def default_error_code
|
|
98
|
+
Constants::DEFAULT_ERROR_CODE
|
|
99
|
+
end
|
|
100
|
+
|
|
17
101
|
##
|
|
18
102
|
# Checks whether an object is a result class.
|
|
19
103
|
#
|
|
@@ -27,6 +27,7 @@ require_relative "plugins/can_have_around_step_callbacks"
|
|
|
27
27
|
require_relative "plugins/can_have_before_step_callbacks"
|
|
28
28
|
require_relative "plugins/can_have_fallbacks"
|
|
29
29
|
require_relative "plugins/can_have_rollbacks"
|
|
30
|
+
require_relative "plugins/can_have_inline_services"
|
|
30
31
|
require_relative "plugins/can_have_stubbed_results"
|
|
31
32
|
require_relative "plugins/can_not_be_inherited"
|
|
32
33
|
require_relative "plugins/can_have_recalculations"
|
data/lib/convenient_service.rb
CHANGED
|
@@ -209,10 +209,12 @@ module ConvenientService
|
|
|
209
209
|
##
|
|
210
210
|
# Returns `true` when Convenient Service is in debug mode. In other words `$CONVENIENT_SERVICE_DEBUG` env variable is set to `true`.
|
|
211
211
|
#
|
|
212
|
-
# @api
|
|
212
|
+
# @api public
|
|
213
213
|
# @since 1.0.0
|
|
214
214
|
# @return [Boolean]
|
|
215
215
|
#
|
|
216
|
+
# @see https://userdocs.convenientservice.org/comprehensive_docs/docs/the_how/how_to_debug_the_convenient_service_lib_itself.html
|
|
217
|
+
#
|
|
216
218
|
def debug?
|
|
217
219
|
Dependencies.debug?
|
|
218
220
|
end
|
|
@@ -249,6 +251,9 @@ module ConvenientService
|
|
|
249
251
|
#
|
|
250
252
|
# @see https://github.com/ruby/logger
|
|
251
253
|
# @see https://ruby-doc.org/stdlib-2.7.0/libdoc/logger/rdoc/Logger.html
|
|
254
|
+
# @see https://userdocs.convenientservice.org/comprehensive_docs/docs/the_how/how_to_debug_the_convenient_service_lib_itself.html
|
|
255
|
+
# @see https://userdocs.convenientservice.org/comprehensive_docs/docs/the_what/what_is_convenient_service_logger.html
|
|
256
|
+
# @see https://userdocs.convenientservice.org/comprehensive_docs/docs/the_how/how_to_configure_convenient_service_logger.html
|
|
252
257
|
#
|
|
253
258
|
# @example Set log level.
|
|
254
259
|
# ConvenientService.logger.level = Logger::DEBUG
|
|
@@ -267,6 +272,7 @@ module ConvenientService
|
|
|
267
272
|
#
|
|
268
273
|
# @see https://ruby-doc.org/core-2.7.1/Kernel.html#method-i-__dir__
|
|
269
274
|
# @see https://api.rubyonrails.org/classes/Rails.html#method-c-root
|
|
275
|
+
# @see https://userdocs.convenientservice.org/comprehensive_docs/docs/the_how/how_to_get_convenient_service_root_folder.html
|
|
270
276
|
#
|
|
271
277
|
def root
|
|
272
278
|
@root ||= ::Pathname.new(::File.expand_path(::File.join(__dir__, "..")))
|
|
@@ -280,6 +286,9 @@ module ConvenientService
|
|
|
280
286
|
# @since 1.0.0
|
|
281
287
|
# @return [Pathname]
|
|
282
288
|
#
|
|
289
|
+
# @internal
|
|
290
|
+
# TODO: Consider to make public for plugin devs.
|
|
291
|
+
#
|
|
283
292
|
def lib_root
|
|
284
293
|
@lib_root ||= ::Pathname.new(::File.join(root, "lib"))
|
|
285
294
|
end
|
|
@@ -292,6 +301,9 @@ module ConvenientService
|
|
|
292
301
|
# @since 1.0.0
|
|
293
302
|
# @return [Pathname]
|
|
294
303
|
#
|
|
304
|
+
# @internal
|
|
305
|
+
# TODO: Consider to make public for plugin devs.
|
|
306
|
+
#
|
|
295
307
|
def examples_root
|
|
296
308
|
@examples_root ||= ::Pathname.new(::File.join(root, "lib", "convenient_service", "examples"))
|
|
297
309
|
end
|
|
@@ -343,6 +355,16 @@ module ConvenientService
|
|
|
343
355
|
@backtrace_cleaner ||= Support::BacktraceCleaner.new
|
|
344
356
|
end
|
|
345
357
|
|
|
358
|
+
##
|
|
359
|
+
# @api public
|
|
360
|
+
# @since 1.0.0
|
|
361
|
+
# @param block [Proc, nil]
|
|
362
|
+
# @return [ConvenientService::Service::Plugins::CanHaveInlineServices::Entities::Proxy]
|
|
363
|
+
#
|
|
364
|
+
def inline(&block)
|
|
365
|
+
Service::Plugins::CanHaveInlineServices.proxy(&block)
|
|
366
|
+
end
|
|
367
|
+
|
|
346
368
|
##
|
|
347
369
|
# Raises Convenient Service exceptions.
|
|
348
370
|
# Cleans exception backtrace with `ConvenientService.backtrace_cleaner.clean` before delegating to `Kernel.raise`.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: convenient_service
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.25.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marian Kostyk
|
|
@@ -436,6 +436,11 @@ files:
|
|
|
436
436
|
- lib/convenient_service/service/plugins/can_have_formatted_exceptions/constants.rb
|
|
437
437
|
- lib/convenient_service/service/plugins/can_have_handled_exceptions.rb
|
|
438
438
|
- lib/convenient_service/service/plugins/can_have_handled_exceptions/concern.rb
|
|
439
|
+
- lib/convenient_service/service/plugins/can_have_inline_services.rb
|
|
440
|
+
- lib/convenient_service/service/plugins/can_have_inline_services/concern.rb
|
|
441
|
+
- lib/convenient_service/service/plugins/can_have_inline_services/entities.rb
|
|
442
|
+
- lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb
|
|
443
|
+
- lib/convenient_service/service/plugins/can_have_inline_services/exceptions.rb
|
|
439
444
|
- lib/convenient_service/service/plugins/can_have_recalculations.rb
|
|
440
445
|
- lib/convenient_service/service/plugins/can_have_recalculations/concern.rb
|
|
441
446
|
- lib/convenient_service/service/plugins/can_have_rollbacks.rb
|
|
@@ -518,8 +523,8 @@ files:
|
|
|
518
523
|
- lib/convenient_service/service/plugins/can_have_steps/entities/step/exceptions.rb
|
|
519
524
|
- lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins.rb
|
|
520
525
|
- lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/aliases.rb
|
|
521
|
-
- lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/
|
|
522
|
-
- lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/
|
|
526
|
+
- lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_evaluated.rb
|
|
527
|
+
- lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_evaluated/concern.rb
|
|
523
528
|
- lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step.rb
|
|
524
529
|
- lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/commands.rb
|
|
525
530
|
- lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/commands/calculate_method_result.rb
|
|
@@ -607,6 +612,7 @@ files:
|
|
|
607
612
|
- lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_fallback/concern.rb
|
|
608
613
|
- lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_handled_exception.rb
|
|
609
614
|
- lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_handled_exception/concern.rb
|
|
615
|
+
- lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_handled_exception/exceptions.rb
|
|
610
616
|
- lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_unhandled_exception.rb
|
|
611
617
|
- lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_unhandled_exception/concern.rb
|
|
612
618
|
- lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_own_result.rb
|