convenient_service 0.24.0 → 0.26.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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/lib/convenient_service/common/plugins/tries_to_convert_result_duck_to_result/middleware.rb +54 -0
  3. data/lib/convenient_service/common/plugins/tries_to_convert_result_duck_to_result.rb +8 -0
  4. data/lib/convenient_service/common/plugins.rb +1 -0
  5. data/lib/convenient_service/dependencies/queries.rb +4 -2
  6. data/lib/convenient_service/extras/rspec.rb +1 -1
  7. data/lib/convenient_service/logger.rb +6 -3
  8. data/lib/convenient_service/rspec/matchers/classes/results/base/entities/printers/error/commands/generate_got_jsend_attributes_part.rb +1 -1
  9. data/lib/convenient_service/rspec/matchers/classes/results/base/entities/printers/failure/commands/generate_got_jsend_attributes_part.rb +1 -1
  10. data/lib/convenient_service/rspec/matchers/classes/results/base/entities/printers/success/commands/generate_got_jsend_attributes_part.rb +1 -1
  11. data/lib/convenient_service/rspec/matchers/classes/results/be_error.rb +1 -1
  12. data/lib/convenient_service/rspec/matchers/classes/results/be_failure.rb +1 -1
  13. data/lib/convenient_service/rspec/matchers/classes/results/be_not_error.rb +2 -2
  14. data/lib/convenient_service/rspec/matchers/classes/results/be_not_failure.rb +2 -2
  15. data/lib/convenient_service/rspec/matchers/classes/results/be_not_success.rb +2 -2
  16. data/lib/convenient_service/rspec/matchers/classes/results/be_success.rb +1 -1
  17. data/lib/convenient_service/service/configs/standard.rb +17 -5
  18. data/lib/convenient_service/service/plugins/can_have_after_step_callbacks/middleware.rb +5 -1
  19. data/lib/convenient_service/service/plugins/can_have_around_step_callbacks/middleware.rb +1 -1
  20. data/lib/convenient_service/service/plugins/can_have_before_step_callbacks/middleware.rb +1 -1
  21. data/lib/convenient_service/service/plugins/can_have_connected_steps/concern.rb +1 -6
  22. data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/scalar.rb +1 -1
  23. data/lib/convenient_service/service/plugins/can_have_inline_services/concern.rb +29 -0
  24. data/lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb +205 -0
  25. data/lib/convenient_service/service/plugins/{can_have_steps/entities/step/plugins/can_be_completed.rb → can_have_inline_services/entities.rb} +1 -1
  26. data/lib/convenient_service/service/plugins/can_have_inline_services/exceptions.rb +30 -0
  27. data/lib/convenient_service/service/plugins/can_have_inline_services.rb +36 -0
  28. data/lib/convenient_service/service/plugins/can_have_sequential_steps/concern.rb +2 -0
  29. data/lib/convenient_service/service/plugins/can_have_sequential_steps/middleware.rb +1 -5
  30. data/lib/convenient_service/service/plugins/can_have_steps/concern.rb +1 -6
  31. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_factory.rb +5 -8
  32. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/proc.rb +1 -1
  33. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/raw.rb +1 -1
  34. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/string.rb +1 -1
  35. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/key.rb +1 -1
  36. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb +13 -0
  37. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/{can_be_completed → can_be_evaluated}/concern.rb +1 -1
  38. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_evaluated.rb +8 -0
  39. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins.rb +1 -1
  40. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_handled_exception/concern.rb +37 -12
  41. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_handled_exception/exceptions.rb +38 -0
  42. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_handled_exception.rb +1 -0
  43. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/concern/instance_methods.rb +7 -0
  44. data/lib/convenient_service/service/plugins/has_j_send_result.rb +84 -0
  45. data/lib/convenient_service/service/plugins/raises_on_not_result_return_value/middleware.rb +7 -3
  46. data/lib/convenient_service/service/plugins.rb +1 -0
  47. data/lib/convenient_service/version.rb +1 -1
  48. data/lib/convenient_service.rb +23 -1
  49. metadata +12 -4
@@ -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 do |step|
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::Factries::Base, nil]
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::Factries::Base, nil]
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::Factries::Base, nil]
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::Factries::Base, nil]
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::Factries::Base, nil]
96
+ # @return [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Entities::Factories::Base, nil]
100
97
  #
101
98
  def cast_method
102
99
  Entities::Factories::Method
@@ -26,7 +26,7 @@ module ConvenientService
26
26
  end
27
27
 
28
28
  def define_output_in_container!(container, index:, method:)
29
- false
29
+ Commands::DefineMethodInContainer.call(method: method, container: container, index: index)
30
30
  end
31
31
 
32
32
  private
@@ -26,7 +26,7 @@ module ConvenientService
26
26
  end
27
27
 
28
28
  def define_output_in_container!(container, index:, method:)
29
- false
29
+ Commands::DefineMethodInContainer.call(method: method, container: container, index: index)
30
30
  end
31
31
 
32
32
  private
@@ -18,7 +18,7 @@ module ConvenientService
18
18
  # @return [ConvenientService::Service::Plugins::CanHaveSteps::Entities::Method::Entities::Key]
19
19
  #
20
20
  def create_key
21
- Entities::Key.new(other)
21
+ Entities::Key.new(other.to_sym)
22
22
  end
23
23
 
24
24
  ##
@@ -25,7 +25,7 @@ module ConvenientService
25
25
  ##
26
26
  # @return [String]
27
27
  #
28
- delegate :to_s, :to_sym, to: :value
28
+ delegate :to_s, to: :value
29
29
 
30
30
  ##
31
31
  # @return [Symbol]
@@ -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
  #
@@ -12,7 +12,7 @@ module ConvenientService
12
12
  module Entities
13
13
  class Step
14
14
  module Plugins
15
- module CanBeCompleted
15
+ module CanBeEvaluated
16
16
  module Concern
17
17
  include Support::Concern
18
18
 
@@ -0,0 +1,8 @@
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_be_evaluated/concern"
@@ -7,7 +7,7 @@
7
7
 
8
8
  require_relative "plugins/has_result"
9
9
 
10
- require_relative "plugins/can_be_completed"
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"
@@ -36,19 +36,44 @@ module ConvenientService
36
36
  end
37
37
 
38
38
  ##
39
- # TODO: error.from_exception(exception)
40
- # TODO: error.from_exception(exception, max_backtrace_size: 5)
41
- # TODO: error("custom_message").from_exception(exception)
42
- # TODO: error(code: :custom_code).from_exception(exception)
39
+ # @return [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result]
40
+ # @raise [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result::Plugins::CanBeFromHandledException::Exceptions::FromExceptionOnNotErrorResult]
43
41
  #
44
- # @internal
45
- # If `error` message is default, use `from_exception` message.
46
- # If `error` code is default, use `from_exception` code.
47
- #
48
- # def from_exception(exception, **kwargs)
49
- # # ...
50
- # end
51
- ##
42
+ def from_exception(exception, **kwargs)
43
+ ::ConvenientService.raise Exceptions::FromExceptionOnNotErrorResult.new(result: self) unless status.unsafe_error?
44
+
45
+ data =
46
+ if Service::Plugins::HasJSendResult.default_error_data == unsafe_data.to_h
47
+ {handled_exception: exception}
48
+ else
49
+ unsafe_data
50
+ end
51
+
52
+ message =
53
+ if Service::Plugins::HasJSendResult.default_error_message == unsafe_message.to_s
54
+ Service::Plugins::CanHaveFormattedExceptions.format_exception(exception, **kwargs)
55
+ else
56
+ unsafe_message
57
+ end
58
+
59
+ code =
60
+ if Service::Plugins::HasJSendResult.default_error_code == unsafe_code.to_sym
61
+ :handled_exception
62
+ else
63
+ unsafe_code
64
+ end
65
+
66
+ copy(
67
+ overrides: {
68
+ kwargs: {
69
+ data: data,
70
+ message: message,
71
+ code: code,
72
+ exceptions: {handled: exception}
73
+ }
74
+ }
75
+ )
76
+ end
52
77
  end
53
78
  end
54
79
  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
@@ -6,3 +6,4 @@
6
6
  ##
7
7
 
8
8
  require_relative "can_be_from_handled_exception/concern"
9
+ require_relative "can_be_from_handled_exception/exceptions"
@@ -103,6 +103,13 @@ module ConvenientService
103
103
  internals.cache[:jsend_attributes]
104
104
  end
105
105
 
106
+ ##
107
+ # @return [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result]
108
+ #
109
+ def result
110
+ self
111
+ end
112
+
106
113
  ##
107
114
  # @param status [Symbol]
108
115
  # @return [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Status]
@@ -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
  #
@@ -12,12 +12,16 @@ module ConvenientService
12
12
  class Middleware < MethodChainMiddleware
13
13
  intended_for any_method, entity: :service
14
14
 
15
+ ##
16
+ # @return [ConvenientService::Service::Plugins::HasJSendResult::Entities::Result]
17
+ # @raise [ConvenientService::Service::Plugins::RaisesOnNotResultReturnValue::Exceptions::ReturnValueNotKindOfResult]
18
+ #
15
19
  def next(...)
16
- original_result = chain.next(...)
20
+ result = chain.next(...)
17
21
 
18
- return original_result if Service::Plugins::HasJSendResult.result?(original_result)
22
+ return result if Service::Plugins::HasJSendResult.result?(result)
19
23
 
20
- ::ConvenientService.raise Exceptions::ReturnValueNotKindOfResult.new(service: entity, result: original_result, method: method)
24
+ ::ConvenientService.raise Exceptions::ReturnValueNotKindOfResult.new(service: entity, result: result, method: method)
21
25
  end
22
26
  end
23
27
  end
@@ -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"
@@ -13,5 +13,5 @@ module ConvenientService
13
13
  # @since 1.0.0
14
14
  # @return [String]
15
15
  #
16
- VERSION = "0.24.0"
16
+ VERSION = "0.26.0"
17
17
  end
@@ -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 private
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.24.0
4
+ version: 0.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marian Kostyk
@@ -108,6 +108,8 @@ files:
108
108
  - lib/convenient_service/common/plugins/has_j_send_result_duck_short_syntax/concern.rb
109
109
  - lib/convenient_service/common/plugins/has_memoization/using_memo_wise.rb
110
110
  - lib/convenient_service/common/plugins/has_memoization/using_memo_wise/concern.rb
111
+ - lib/convenient_service/common/plugins/tries_to_convert_result_duck_to_result.rb
112
+ - lib/convenient_service/common/plugins/tries_to_convert_result_duck_to_result/middleware.rb
111
113
  - lib/convenient_service/config.rb
112
114
  - lib/convenient_service/config/commands.rb
113
115
  - lib/convenient_service/config/commands/normalize_options.rb
@@ -436,6 +438,11 @@ files:
436
438
  - lib/convenient_service/service/plugins/can_have_formatted_exceptions/constants.rb
437
439
  - lib/convenient_service/service/plugins/can_have_handled_exceptions.rb
438
440
  - lib/convenient_service/service/plugins/can_have_handled_exceptions/concern.rb
441
+ - lib/convenient_service/service/plugins/can_have_inline_services.rb
442
+ - lib/convenient_service/service/plugins/can_have_inline_services/concern.rb
443
+ - lib/convenient_service/service/plugins/can_have_inline_services/entities.rb
444
+ - lib/convenient_service/service/plugins/can_have_inline_services/entities/proxy.rb
445
+ - lib/convenient_service/service/plugins/can_have_inline_services/exceptions.rb
439
446
  - lib/convenient_service/service/plugins/can_have_recalculations.rb
440
447
  - lib/convenient_service/service/plugins/can_have_recalculations/concern.rb
441
448
  - lib/convenient_service/service/plugins/can_have_rollbacks.rb
@@ -518,8 +525,8 @@ files:
518
525
  - lib/convenient_service/service/plugins/can_have_steps/entities/step/exceptions.rb
519
526
  - lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins.rb
520
527
  - 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/can_be_completed.rb
522
- - lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_completed/concern.rb
528
+ - lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_evaluated.rb
529
+ - lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_evaluated/concern.rb
523
530
  - lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step.rb
524
531
  - lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/commands.rb
525
532
  - lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/commands/calculate_method_result.rb
@@ -607,6 +614,7 @@ files:
607
614
  - lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_fallback/concern.rb
608
615
  - lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_handled_exception.rb
609
616
  - lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_handled_exception/concern.rb
617
+ - lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_handled_exception/exceptions.rb
610
618
  - lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_unhandled_exception.rb
611
619
  - lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_from_unhandled_exception/concern.rb
612
620
  - lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_own_result.rb
@@ -906,7 +914,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
906
914
  - !ruby/object:Gem::Version
907
915
  version: '0'
908
916
  requirements: []
909
- rubygems_version: 4.0.3
917
+ rubygems_version: 4.0.20
910
918
  specification_version: 4
911
919
  summary: Ruby Service Objects with Steps and more.
912
920
  test_files: []