convenient_service 0.11.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (713) hide show
  1. checksums.yaml +4 -4
  2. data/.dev/.tmuxinator.yml +6 -1
  3. data/.github/workflows/ci.yml +23 -1
  4. data/.gitignore +18 -0
  5. data/.vscode/CacheItsValue.code-snippets +15 -0
  6. data/.vscode/DelegateTo.code-snippets +15 -0
  7. data/.vscode/cache_its_value.code-snippets +17 -0
  8. data/.vscode/comparison.code-snippets +41 -0
  9. data/.vscode/delegate_to.code-snippets +20 -0
  10. data/Appraisals +24 -2
  11. data/CHANGELOG.md +205 -0
  12. data/Gemfile +12 -1
  13. data/README.md +14 -4
  14. data/ROADMAP.md +5 -1
  15. data/Taskfile.yml +320 -21
  16. data/benchmark/commit_config/ips.rb +18 -0
  17. data/benchmark/commit_config/profile.rb +30 -0
  18. data/benchmark/empty_service/ips.rb +123 -0
  19. data/benchmark/has_committed_config/ips.rb +78 -0
  20. data/benchmark/has_committed_config/profile.rb +30 -0
  21. data/convenient_service.gemspec +165 -6
  22. data/docker/2.7/Dockerfile +3 -3
  23. data/docker/3.0/Dockerfile +2 -2
  24. data/docker/3.1/Dockerfile +2 -2
  25. data/docker/3.2/Dockerfile +73 -0
  26. data/docker/jruby-9.4/Dockerfile +88 -0
  27. data/docker/truffleruby-22.3/Dockerfile +91 -0
  28. data/gemfiles/.gitkeep +0 -0
  29. data/lib/convenient_service/alias.rb +3 -0
  30. data/lib/convenient_service/aliases.rb +0 -4
  31. data/lib/convenient_service/common/plugins/aliases.rb +0 -1
  32. data/lib/convenient_service/common/plugins/assigns_attributes_in_constructor/using_active_model_attribute_assignment/middleware.rb +15 -9
  33. data/lib/convenient_service/common/plugins/caches_constructor_arguments/concern.rb +22 -0
  34. data/lib/convenient_service/common/plugins/caches_constructor_arguments/middleware.rb +22 -0
  35. data/lib/convenient_service/common/plugins/caches_constructor_arguments.rb +4 -0
  36. data/lib/convenient_service/common/plugins/caches_return_value/middleware.rb +12 -8
  37. data/lib/convenient_service/common/plugins/can_be_copied/concern.rb +22 -5
  38. data/lib/convenient_service/common/plugins/can_have_user_provided_entity/commands/find_or_create_entity.rb +9 -7
  39. data/lib/convenient_service/common/plugins/can_have_user_provided_entity/{errors.rb → exceptions.rb} +4 -4
  40. data/lib/convenient_service/common/plugins/can_have_user_provided_entity.rb +1 -1
  41. data/lib/convenient_service/common/plugins/can_utilize_finite_loop/concern.rb +40 -0
  42. data/lib/convenient_service/common/plugins/can_utilize_finite_loop/constants.rb +21 -0
  43. data/lib/convenient_service/common/plugins/can_utilize_finite_loop.rb +4 -0
  44. data/lib/convenient_service/common/plugins/has_around_callbacks/{errors.rb → exceptions.rb} +2 -2
  45. data/lib/convenient_service/common/plugins/has_around_callbacks/middleware.rb +9 -3
  46. data/lib/convenient_service/common/plugins/has_around_callbacks.rb +1 -1
  47. data/lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb +8 -8
  48. data/lib/convenient_service/common/plugins/has_callbacks/middleware.rb +7 -1
  49. data/lib/convenient_service/common/plugins/has_constructor/concern.rb +3 -4
  50. data/lib/convenient_service/common/plugins/has_constructor_without_initialize/concern.rb +1 -9
  51. data/lib/convenient_service/common/plugins/has_internals/entities/internals/plugins/aliases.rb +7 -0
  52. data/lib/convenient_service/common/plugins/has_internals/entities/internals/plugins/has_cache/concern.rb +1 -1
  53. data/lib/convenient_service/common/plugins/has_internals/entities/internals/plugins.rb +2 -0
  54. data/lib/convenient_service/common/plugins/has_j_send_result_duck_short_syntax/concern.rb +68 -0
  55. data/lib/convenient_service/common/plugins/has_j_send_result_duck_short_syntax.rb +3 -0
  56. data/lib/convenient_service/common/plugins/normalizes_env/middleware.rb +3 -1
  57. data/lib/convenient_service/common/plugins.rb +2 -1
  58. data/lib/convenient_service/configs/awesome_print_inspect/aliases.rb +7 -0
  59. data/lib/convenient_service/configs/awesome_print_inspect.rb +59 -0
  60. data/lib/convenient_service/configs/minimal.rb +86 -15
  61. data/lib/convenient_service/configs/standard.rb +92 -30
  62. data/lib/convenient_service/core/aliases.rb +4 -5
  63. data/lib/convenient_service/core/concern/class_methods.rb +129 -0
  64. data/lib/convenient_service/core/concern/instance_methods.rb +76 -0
  65. data/lib/convenient_service/core/concern.rb +25 -0
  66. data/lib/convenient_service/core/constants.rb +36 -0
  67. data/lib/convenient_service/core/entities/config/commands/track_method_missing_commit_trigger.rb +69 -0
  68. data/lib/convenient_service/core/entities/config/commands.rb +3 -0
  69. data/lib/convenient_service/core/entities/config/entities/concerns/entities/middleware/commands/cast_middleware.rb +2 -2
  70. data/lib/convenient_service/core/entities/config/entities/concerns/entities/middleware.rb +1 -0
  71. data/lib/convenient_service/core/entities/config/entities/concerns/entities/stack.rb +10 -10
  72. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller/commands/cast_caller.rb +2 -2
  73. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller/concern/instance_methods.rb +9 -2
  74. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller/constants.rb +26 -0
  75. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller.rb +1 -3
  76. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/container/concern/instance_methods.rb +10 -3
  77. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware_creators/base.rb +95 -0
  78. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware_creators/observable/entities/event.rb +95 -0
  79. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware_creators/observable/entities.rb +3 -0
  80. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware_creators/observable.rb +42 -0
  81. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware_creators/with.rb +50 -0
  82. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware_creators.rb +6 -0
  83. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/commands/create_observable_middleware.rb +104 -0
  84. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/commands.rb +3 -0
  85. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/concern/class_methods.rb +115 -0
  86. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/concern/instance_methods.rb +70 -0
  87. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/concern.rb +32 -0
  88. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/constants.rb +36 -0
  89. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/structs/intended_method.rb +23 -0
  90. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/structs.rb +3 -0
  91. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base.rb +26 -0
  92. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/commands/create_observable_middleware.rb +90 -0
  93. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/commands.rb +3 -0
  94. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/concern/class_methods.rb +37 -0
  95. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/concern/instance_methods.rb +115 -0
  96. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/concern.rb +32 -0
  97. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/entities/method_chain.rb +86 -0
  98. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/entities.rb +3 -0
  99. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain.rb +34 -0
  100. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/classic.rb +42 -0
  101. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares.rb +6 -0
  102. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/stack.rb +58 -23
  103. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities.rb +2 -2
  104. data/lib/convenient_service/core/entities/config/entities/method_middlewares.rb +2 -2
  105. data/lib/convenient_service/core/entities/config/exceptions.rb +64 -0
  106. data/lib/convenient_service/core/entities/config.rb +32 -9
  107. data/lib/convenient_service/core/entities.rb +0 -1
  108. data/lib/convenient_service/core.rb +8 -5
  109. data/lib/convenient_service/dependencies/built_in.rb +18 -4
  110. data/lib/convenient_service/dependencies/extractions/active_support_backtrace_cleaner/backtrace_cleaner.rb +149 -0
  111. data/lib/convenient_service/dependencies/extractions/active_support_backtrace_cleaner.rb +15 -0
  112. data/lib/convenient_service/dependencies/extractions/active_support_concern/concern.rb +19 -2
  113. data/lib/convenient_service/dependencies/extractions/active_support_concern.rb +8 -3
  114. data/lib/convenient_service/dependencies/extractions/ruby_middleware/middleware/builder.rb +7 -1
  115. data/lib/convenient_service/dependencies/extractions/ruby_middleware/middleware/logger.rb +7 -1
  116. data/lib/convenient_service/dependencies/extractions/ruby_middleware/middleware/runner.rb +15 -1
  117. data/lib/convenient_service/dependencies/extractions/ruby_middleware/middleware.rb +8 -1
  118. data/lib/convenient_service/dependencies/extractions/ruby_middleware.rb +3 -2
  119. data/lib/convenient_service/dependencies.rb +269 -30
  120. data/lib/convenient_service/examples/dry/gemfile/dry_service/config.rb +19 -21
  121. data/lib/convenient_service/examples/dry/gemfile/services/assert_file_exists.rb +1 -1
  122. data/lib/convenient_service/examples/dry/gemfile/services/assert_file_not_empty.rb +1 -1
  123. data/lib/convenient_service/examples/dry/gemfile/services/assert_node_available.rb +2 -2
  124. data/lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb +2 -2
  125. data/lib/convenient_service/examples/dry/gemfile/services/assert_valid_ruby_syntax.rb +2 -2
  126. data/lib/convenient_service/examples/dry/gemfile/services/format.rb +1 -1
  127. data/lib/convenient_service/examples/dry/gemfile/services/format_body.rb +1 -1
  128. data/lib/convenient_service/examples/dry/gemfile/services/format_gems_with_envs.rb +1 -1
  129. data/lib/convenient_service/examples/dry/gemfile/services/format_gems_without_envs.rb +1 -1
  130. data/lib/convenient_service/examples/dry/gemfile/services/format_header.rb +1 -1
  131. data/lib/convenient_service/examples/dry/gemfile/services/parse_content.rb +1 -1
  132. data/lib/convenient_service/examples/dry/gemfile/services/print_shell_command.rb +11 -4
  133. data/lib/convenient_service/examples/dry/gemfile/services/read_file_content.rb +1 -1
  134. data/lib/convenient_service/examples/dry/gemfile/services/{run_shell.rb → run_shell_command.rb} +10 -5
  135. data/lib/convenient_service/examples/dry/gemfile/services/strip_comments.rb +2 -2
  136. data/lib/convenient_service/examples/dry/gemfile/services.rb +3 -2
  137. data/lib/convenient_service/examples/dry/gemfile.rb +5 -5
  138. data/lib/convenient_service/examples/rails/gemfile/rails_service/config.rb +28 -30
  139. data/lib/convenient_service/examples/rails/gemfile/services/assert_file_exists.rb +2 -2
  140. data/lib/convenient_service/examples/rails/gemfile/services/assert_file_not_empty.rb +2 -2
  141. data/lib/convenient_service/examples/rails/gemfile/services/assert_node_available.rb +2 -2
  142. data/lib/convenient_service/examples/rails/gemfile/services/assert_npm_package_available.rb +3 -3
  143. data/lib/convenient_service/examples/rails/gemfile/services/assert_valid_ruby_syntax.rb +2 -2
  144. data/lib/convenient_service/examples/rails/gemfile/services/format.rb +2 -2
  145. data/lib/convenient_service/examples/rails/gemfile/services/format_body.rb +1 -1
  146. data/lib/convenient_service/examples/rails/gemfile/services/format_gems_with_envs.rb +1 -1
  147. data/lib/convenient_service/examples/rails/gemfile/services/format_gems_without_envs.rb +1 -1
  148. data/lib/convenient_service/examples/rails/gemfile/services/format_header.rb +1 -1
  149. data/lib/convenient_service/examples/rails/gemfile/services/merge_sections.rb +3 -3
  150. data/lib/convenient_service/examples/rails/gemfile/services/parse_content.rb +2 -2
  151. data/lib/convenient_service/examples/rails/gemfile/services/print_shell_command.rb +11 -4
  152. data/lib/convenient_service/examples/rails/gemfile/services/read_file_content.rb +2 -2
  153. data/lib/convenient_service/examples/rails/gemfile/services/replace_file_content.rb +3 -3
  154. data/lib/convenient_service/examples/rails/gemfile/services/{run_shell.rb → run_shell_command.rb} +11 -6
  155. data/lib/convenient_service/examples/rails/gemfile/services/strip_comments.rb +3 -3
  156. data/lib/convenient_service/examples/rails/gemfile/services.rb +2 -2
  157. data/lib/convenient_service/examples/rails/gemfile.rb +5 -5
  158. data/lib/convenient_service/examples/standard/cowsay/services/build_cloud.rb +1 -1
  159. data/lib/convenient_service/examples/standard/cowsay/services/build_cow.rb +1 -1
  160. data/lib/convenient_service/examples/standard/cowsay/services/print.rb +1 -1
  161. data/lib/convenient_service/examples/standard/cowsay.rb +5 -5
  162. data/lib/convenient_service/examples/standard/date_time/services/safe_parse.rb +31 -0
  163. data/lib/convenient_service/examples/standard/date_time/services.rb +3 -0
  164. data/lib/convenient_service/examples/standard/date_time.rb +23 -0
  165. data/lib/convenient_service/examples/standard/factorial/services/calculate.rb +49 -0
  166. data/lib/convenient_service/examples/standard/factorial/services.rb +3 -0
  167. data/lib/convenient_service/examples/standard/factorial/utils/timeout/with_timeout.rb +50 -0
  168. data/lib/convenient_service/examples/standard/factorial/utils/timeout.rb +21 -0
  169. data/lib/convenient_service/examples/standard/factorial/utils.rb +3 -0
  170. data/lib/convenient_service/examples/standard/factorial.rb +24 -0
  171. data/lib/convenient_service/examples/standard/gemfile/services/assert_file_exists.rb +2 -2
  172. data/lib/convenient_service/examples/standard/gemfile/services/assert_file_not_empty.rb +2 -2
  173. data/lib/convenient_service/examples/standard/gemfile/services/assert_node_available.rb +2 -11
  174. data/lib/convenient_service/examples/standard/gemfile/services/assert_npm_package_available.rb +2 -12
  175. data/lib/convenient_service/examples/standard/gemfile/services/assert_valid_ruby_syntax.rb +2 -2
  176. data/lib/convenient_service/examples/standard/gemfile/services/format.rb +1 -11
  177. data/lib/convenient_service/examples/standard/gemfile/services/format_body.rb +1 -1
  178. data/lib/convenient_service/examples/standard/gemfile/services/format_gems_with_envs.rb +1 -1
  179. data/lib/convenient_service/examples/standard/gemfile/services/format_gems_without_envs.rb +1 -1
  180. data/lib/convenient_service/examples/standard/gemfile/services/format_header.rb +1 -1
  181. data/lib/convenient_service/examples/standard/gemfile/services/merge_sections.rb +1 -11
  182. data/lib/convenient_service/examples/standard/gemfile/services/parse_content.rb +1 -11
  183. data/lib/convenient_service/examples/standard/gemfile/services/print_shell_command.rb +15 -8
  184. data/lib/convenient_service/examples/standard/gemfile/services/read_file_content.rb +2 -12
  185. data/lib/convenient_service/examples/standard/gemfile/services/replace_file_content.rb +1 -11
  186. data/lib/convenient_service/examples/standard/gemfile/services/{run_shell.rb → run_shell_command.rb} +22 -5
  187. data/lib/convenient_service/examples/standard/gemfile/services/strip_comments.rb +2 -2
  188. data/lib/convenient_service/examples/standard/gemfile/services.rb +2 -2
  189. data/lib/convenient_service/examples/standard/gemfile.rb +5 -5
  190. data/lib/convenient_service/examples/standard/request_params/constants.rb +1 -1
  191. data/lib/convenient_service/examples/standard/request_params/entities/description.rb +1 -1
  192. data/lib/convenient_service/examples/standard/request_params/entities/format.rb +1 -1
  193. data/lib/convenient_service/examples/standard/request_params/entities/id.rb +1 -1
  194. data/lib/convenient_service/examples/standard/request_params/entities/logger.rb +1 -1
  195. data/lib/convenient_service/examples/standard/request_params/entities/request.rb +1 -1
  196. data/lib/convenient_service/examples/standard/request_params/entities/source.rb +1 -1
  197. data/lib/convenient_service/examples/standard/request_params/entities/tag.rb +1 -1
  198. data/lib/convenient_service/examples/standard/request_params/entities/title.rb +1 -1
  199. data/lib/convenient_service/examples/standard/request_params/services/apply_default_param_values.rb +1 -1
  200. data/lib/convenient_service/examples/standard/request_params/services/cast_params.rb +1 -1
  201. data/lib/convenient_service/examples/standard/request_params/services/extract_params_from_body.rb +1 -11
  202. data/lib/convenient_service/examples/standard/request_params/services/extract_params_from_path.rb +1 -11
  203. data/lib/convenient_service/examples/standard/request_params/services/filter_out_unpermitted_params.rb +1 -1
  204. data/lib/convenient_service/examples/standard/request_params/services/log_request_params.rb +1 -1
  205. data/lib/convenient_service/examples/standard/request_params/services/merge_params.rb +1 -1
  206. data/lib/convenient_service/examples/standard/request_params/services/prepare.rb +1 -1
  207. data/lib/convenient_service/examples/standard/request_params/services/validate_casted_params.rb +1 -11
  208. data/lib/convenient_service/examples/standard/request_params/services/validate_uncasted_params.rb +1 -11
  209. data/lib/convenient_service/examples/standard/request_params/utils/array/wrap.rb +2 -2
  210. data/lib/convenient_service/examples/standard/request_params/utils/array.rb +1 -1
  211. data/lib/convenient_service/examples/standard/request_params/utils/http/request/parse_body.rb +2 -2
  212. data/lib/convenient_service/examples/standard/request_params/utils/http/request/parse_path.rb +2 -2
  213. data/lib/convenient_service/examples/standard/request_params/utils/http/request.rb +1 -1
  214. data/lib/convenient_service/examples/standard/request_params/utils/integer/safe_parse.rb +2 -2
  215. data/lib/convenient_service/examples/standard/request_params/utils/integer.rb +1 -1
  216. data/lib/convenient_service/examples/standard/request_params/utils/json/safe_parse.rb +2 -2
  217. data/lib/convenient_service/examples/standard/request_params/utils/json.rb +1 -1
  218. data/lib/convenient_service/examples/standard/request_params/utils/object/blank.rb +2 -2
  219. data/lib/convenient_service/examples/standard/request_params/utils/object/present.rb +2 -2
  220. data/lib/convenient_service/examples/standard/request_params/utils/object.rb +1 -1
  221. data/lib/convenient_service/examples/standard/request_params/utils/url/valid.rb +47 -0
  222. data/lib/convenient_service/examples/standard/request_params/utils/url.rb +21 -0
  223. data/lib/convenient_service/examples/standard/request_params/utils.rb +1 -0
  224. data/lib/convenient_service/examples/standard/request_params.rb +5 -5
  225. data/lib/convenient_service/exception.rb +16 -0
  226. data/lib/convenient_service/feature.rb +11 -0
  227. data/lib/convenient_service/logger.rb +71 -25
  228. data/lib/convenient_service/rspec/helpers/custom/ignoring_exception/exceptions.rb +27 -0
  229. data/lib/convenient_service/rspec/helpers/custom/ignoring_exception.rb +51 -0
  230. data/lib/convenient_service/rspec/helpers/custom/in_threads.rb +74 -0
  231. data/lib/convenient_service/rspec/helpers/custom/stub_service/constants.rb +20 -0
  232. data/lib/convenient_service/rspec/helpers/custom/stub_service/entities/result_spec.rb +2 -2
  233. data/lib/convenient_service/rspec/helpers/custom/stub_service/entities/stubbed_service.rb +22 -18
  234. data/lib/convenient_service/rspec/helpers/custom/stub_service.rb +1 -0
  235. data/lib/convenient_service/rspec/helpers/custom/wrap_method/entities/wrapped_method.rb +113 -56
  236. data/lib/convenient_service/rspec/helpers/custom/wrap_method/{errors.rb → exceptions.rb} +2 -2
  237. data/lib/convenient_service/rspec/helpers/custom/wrap_method.rb +31 -7
  238. data/lib/convenient_service/rspec/helpers/custom.rb +2 -1
  239. data/lib/convenient_service/rspec/helpers/ignoring_exception.rb +13 -0
  240. data/lib/convenient_service/rspec/helpers/{ignoring_error.rb → in_threads.rb} +3 -3
  241. data/lib/convenient_service/rspec/helpers.rb +4 -2
  242. data/lib/convenient_service/rspec/matchers/custom/be_descendant_of.rb +1 -1
  243. data/lib/convenient_service/rspec/matchers/custom/cache_its_value.rb +20 -0
  244. data/lib/convenient_service/rspec/matchers/custom/call_chain_next.rb +103 -2
  245. data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings/sub_matchers/return_its_value.rb +3 -0
  246. data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings/sub_matchers/with_concrete_arguments.rb +1 -1
  247. data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings_collection/{errors.rb → exceptions.rb} +4 -4
  248. data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings_collection.rb +11 -11
  249. data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/delegation.rb +3 -3
  250. data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher.rb +5 -5
  251. data/lib/convenient_service/rspec/matchers/custom/delegate_to.rb +13 -3
  252. data/lib/convenient_service/rspec/matchers/custom/export.rb +82 -0
  253. data/lib/convenient_service/rspec/matchers/custom/have_abstract_method.rb +1 -1
  254. data/lib/convenient_service/rspec/matchers/custom/have_alias_method.rb +3 -0
  255. data/lib/convenient_service/rspec/matchers/custom/results/base/constants.rb +31 -0
  256. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/chain.rb +226 -0
  257. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_expected_code_part.rb +61 -0
  258. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_expected_data_part.rb +61 -0
  259. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_expected_message_part.rb +61 -0
  260. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_expected_parts.rb +121 -0
  261. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_expected_service_part.rb +61 -0
  262. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_expected_status_part.rb +68 -0
  263. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_expected_step_part.rb +61 -0
  264. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_got_parts.rb +98 -0
  265. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_got_service_part.rb +68 -0
  266. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_got_step_part.rb +68 -0
  267. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands.rb +13 -0
  268. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base.rb +207 -0
  269. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/error/commands/generate_got_jsend_attributes_part.rb +120 -0
  270. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/error/commands.rb +3 -0
  271. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/error.rb +34 -0
  272. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/failure/commands/generate_got_jsend_attributes_part.rb +121 -0
  273. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/failure/commands.rb +3 -0
  274. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/failure.rb +34 -0
  275. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/null.rb +147 -0
  276. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/success/commands/generate_got_jsend_attributes_part.rb +96 -0
  277. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/success/commands.rb +3 -0
  278. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/success.rb +34 -0
  279. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers.rb +46 -0
  280. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands/validate_result.rb +121 -0
  281. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands/validate_result_code.rb +97 -0
  282. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands/validate_result_data.rb +97 -0
  283. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands/validate_result_message.rb +97 -0
  284. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands/validate_result_service.rb +81 -0
  285. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands/validate_result_status.rb +92 -0
  286. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands/validate_result_step.rb +127 -0
  287. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands/validate_result_type.rb +89 -0
  288. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands.rb +10 -0
  289. data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator.rb +123 -0
  290. data/lib/convenient_service/rspec/matchers/custom/results/base/entities.rb +5 -0
  291. data/lib/convenient_service/rspec/matchers/custom/results/base/{errors.rb → exceptions.rb} +8 -2
  292. data/lib/convenient_service/rspec/matchers/custom/results/base.rb +113 -149
  293. data/lib/convenient_service/rspec/matchers/custom/results/be_error.rb +6 -1
  294. data/lib/convenient_service/rspec/matchers/custom/results/be_failure.rb +6 -1
  295. data/lib/convenient_service/rspec/matchers/custom/results/be_not_error.rb +7 -2
  296. data/lib/convenient_service/rspec/matchers/custom/results/be_not_failure.rb +7 -2
  297. data/lib/convenient_service/rspec/matchers/custom/results/be_not_success.rb +7 -2
  298. data/lib/convenient_service/rspec/matchers/custom/results/be_success.rb +6 -1
  299. data/lib/convenient_service/rspec/matchers/custom.rb +1 -0
  300. data/lib/convenient_service/rspec/matchers/export.rb +13 -0
  301. data/lib/convenient_service/rspec/matchers/results/be_error.rb +3 -0
  302. data/lib/convenient_service/rspec/matchers/results/be_failure.rb +3 -0
  303. data/lib/convenient_service/rspec/matchers/results/be_not_error.rb +3 -0
  304. data/lib/convenient_service/rspec/matchers/results/be_not_failure.rb +3 -0
  305. data/lib/convenient_service/rspec/matchers/results/be_not_success.rb +3 -0
  306. data/lib/convenient_service/rspec/matchers/results/be_success.rb +3 -0
  307. data/lib/convenient_service/rspec/matchers.rb +2 -0
  308. data/lib/convenient_service/service/plugins/aliases.rb +0 -2
  309. data/lib/convenient_service/service/plugins/can_have_fallback/concern.rb +93 -0
  310. data/lib/convenient_service/service/plugins/can_have_fallback/exceptions.rb +36 -0
  311. data/lib/convenient_service/service/plugins/can_have_fallback/middleware.rb +30 -0
  312. data/lib/convenient_service/service/plugins/can_have_fallback.rb +5 -0
  313. data/lib/convenient_service/service/plugins/can_have_method_steps/middleware.rb +7 -26
  314. data/lib/convenient_service/service/plugins/can_have_steps/concern.rb +5 -2
  315. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method.rb +46 -11
  316. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_direction.rb +29 -2
  317. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_factory.rb +113 -0
  318. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb +2 -2
  319. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands.rb +1 -3
  320. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb +96 -26
  321. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/alias.rb +2 -2
  322. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/base.rb +49 -7
  323. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/proc.rb +1 -1
  324. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/raw.rb +1 -1
  325. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/reassignment.rb +2 -2
  326. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/usual.rb +2 -2
  327. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/directions/base.rb +27 -4
  328. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/directions/input.rb +2 -2
  329. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/directions/output.rb +1 -1
  330. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/base.rb +62 -0
  331. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/base.rb +35 -0
  332. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/proc_value.rb +42 -0
  333. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/raw_value.rb +42 -0
  334. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/reassignment_value.rb +42 -0
  335. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/string_value.rb +42 -0
  336. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/symbol_value.rb +42 -0
  337. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash.rb +8 -0
  338. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/method.rb +40 -0
  339. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/reassignment.rb +40 -0
  340. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/string.rb +40 -0
  341. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/symbol.rb +40 -0
  342. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories.rb +8 -0
  343. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/key.rb +31 -1
  344. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/name.rb +31 -1
  345. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities.rb +1 -0
  346. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/{errors.rb → exceptions.rb} +81 -15
  347. data/lib/convenient_service/service/plugins/can_have_steps/entities/method.rb +1 -1
  348. data/lib/convenient_service/service/plugins/can_have_steps/entities/service/concern/class_methods.rb +46 -0
  349. data/lib/convenient_service/service/plugins/can_have_steps/entities/service/concern/instance_methods.rb +64 -0
  350. data/lib/convenient_service/service/plugins/can_have_steps/entities/service/concern.rb +28 -0
  351. data/lib/convenient_service/service/plugins/can_have_steps/entities/service.rb +7 -30
  352. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/commands/cast_params.rb +39 -2
  353. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/commands/extract_params.rb +2 -4
  354. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb +229 -64
  355. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/exceptions.rb +27 -0
  356. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/aliases.rb +7 -0
  357. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_completed/concern.rb +44 -0
  358. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_completed.rb +3 -0
  359. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/can_be_executed/middleware.rb +36 -0
  360. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/can_be_executed.rb +3 -0
  361. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/can_be_printed/middleware.rb +32 -0
  362. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/can_be_printed.rb +3 -0
  363. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/concern.rb +37 -0
  364. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step.rb +6 -0
  365. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step/can_be_executed/exceptions.rb +38 -0
  366. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step/can_be_executed/middleware.rb +72 -0
  367. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step/can_be_executed.rb +4 -0
  368. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step/concern.rb +30 -0
  369. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step.rb +5 -0
  370. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallback/concern.rb +53 -0
  371. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallback/middleware.rb +34 -0
  372. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallback/result.rb +3 -0
  373. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallback.rb +4 -0
  374. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_parent_result/middleware.rb +4 -2
  375. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/has_awesome_print_inspect/concern.rb +45 -0
  376. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/has_awesome_print_inspect.rb +3 -0
  377. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/has_inspect/concern.rb +5 -1
  378. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins.rb +6 -0
  379. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/structs/params.rb +1 -1
  380. data/lib/convenient_service/service/plugins/can_have_steps/entities/step.rb +1 -1
  381. data/lib/convenient_service/service/plugins/can_have_steps/entities/step_collection.rb +37 -8
  382. data/lib/convenient_service/service/plugins/can_have_steps/middleware.rb +38 -9
  383. data/lib/convenient_service/service/plugins/can_have_stubbed_results/commands/fetch_all_services_stubbed_results_cache.rb +30 -0
  384. data/lib/convenient_service/service/plugins/can_have_stubbed_results/commands/fetch_service_stubbed_results_cache.rb +43 -0
  385. data/lib/convenient_service/service/plugins/can_have_stubbed_results/commands/get_service_stubbed_result.rb +58 -0
  386. data/lib/convenient_service/service/plugins/can_have_stubbed_results/commands/set_service_stubbed_result.rb +66 -0
  387. data/lib/convenient_service/service/plugins/can_have_stubbed_results/commands.rb +6 -0
  388. data/lib/convenient_service/service/plugins/can_have_stubbed_results/concern.rb +46 -0
  389. data/lib/convenient_service/service/plugins/can_have_stubbed_results/container.rb +17 -0
  390. data/lib/convenient_service/service/plugins/can_have_stubbed_results/middleware.rb +65 -0
  391. data/lib/convenient_service/service/plugins/can_have_stubbed_results.rb +6 -0
  392. data/lib/convenient_service/service/plugins/can_recalculate_result/concern.rb +1 -1
  393. data/lib/convenient_service/service/plugins/collects_services_in_exception/commands/extract_service_details.rb +64 -0
  394. data/lib/convenient_service/service/plugins/collects_services_in_exception/commands.rb +3 -0
  395. data/lib/convenient_service/service/plugins/collects_services_in_exception/constants.rb +16 -0
  396. data/lib/convenient_service/service/plugins/collects_services_in_exception/middleware.rb +50 -0
  397. data/lib/convenient_service/service/plugins/collects_services_in_exception.rb +5 -0
  398. data/lib/convenient_service/service/plugins/counts_stubbed_results_invocations/middleware.rb +24 -0
  399. data/lib/convenient_service/service/plugins/counts_stubbed_results_invocations.rb +3 -0
  400. data/lib/convenient_service/service/plugins/has_awesome_print_inspect/concern.rb +39 -0
  401. data/lib/convenient_service/service/plugins/has_awesome_print_inspect.rb +3 -0
  402. data/lib/convenient_service/service/plugins/has_inspect/concern.rb +8 -1
  403. data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/commands/create_result_class.rb +1 -1
  404. data/lib/convenient_service/service/plugins/has_j_send_result/commands/is_result.rb +34 -0
  405. data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/commands.rb +2 -0
  406. data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/concern/class_methods.rb +21 -18
  407. data/lib/convenient_service/service/plugins/has_j_send_result/concern/instance_methods.rb +49 -0
  408. data/lib/convenient_service/service/plugins/has_j_send_result/concern.rb +22 -0
  409. data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/constants.rb +1 -1
  410. data/lib/convenient_service/service/plugins/has_j_send_result/container.rb +21 -0
  411. data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/concern.rb +1 -1
  412. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/aliases.rb +7 -0
  413. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_own_result/concern.rb +142 -0
  414. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_own_result.rb +3 -0
  415. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_stubbed_result/concern.rb +30 -0
  416. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_stubbed_result.rb +3 -0
  417. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_checked_status/concern.rb +30 -0
  418. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_checked_status/middleware.rb +43 -0
  419. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_checked_status.rb +4 -0
  420. data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/has_step → has_j_send_result/entities/result/plugins/can_have_fallback}/concern.rb +7 -4
  421. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_fallback.rb +3 -0
  422. data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/can_have_parent_result/concern.rb +19 -9
  423. data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/has_jsend_status_and_attributes/concern/class_methods.rb → has_j_send_result/entities/result/plugins/can_have_parent_result/constants.rb} +4 -5
  424. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_parent_result.rb +4 -0
  425. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_step/concern.rb +30 -0
  426. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_step.rb +3 -0
  427. data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/can_recalculate_result/concern.rb +1 -1
  428. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_awesome_print_inspect/concern.rb +38 -0
  429. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_awesome_print_inspect.rb +3 -0
  430. data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_inspect/concern.rb +2 -3
  431. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/commands/cast_j_send_attributes.rb +99 -0
  432. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/commands/create_code_class.rb +49 -0
  433. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/commands/create_data_class.rb +49 -0
  434. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/commands/create_message_class.rb +49 -0
  435. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/commands/create_status_class.rb +49 -0
  436. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/commands.rb +7 -0
  437. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/concern/class_methods.rb +125 -0
  438. data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/has_jsend_status_and_attributes → has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes}/concern/instance_methods.rb +59 -15
  439. data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/has_jsend_status_and_attributes → has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes}/concern.rb +2 -2
  440. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/commands/is_code.rb +49 -0
  441. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/commands.rb +3 -0
  442. data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/has_jsend_status_and_attributes → has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes}/entities/code/concern/class_methods.rb +15 -3
  443. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/concern/instance_methods.rb +123 -0
  444. data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/has_jsend_status_and_attributes → has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes}/entities/code/concern.rb +2 -2
  445. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/plugins/aliases.rb +7 -0
  446. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/plugins/has_awesome_print_inspect/concern.rb +46 -0
  447. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/plugins/has_awesome_print_inspect.rb +3 -0
  448. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/plugins/has_inspect/concern.rb +38 -0
  449. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/plugins/has_inspect.rb +3 -0
  450. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/plugins.rb +5 -0
  451. data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/has_jsend_status_and_attributes → has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes}/entities/code.rb +4 -2
  452. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/commands/is_data.rb +49 -0
  453. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/commands.rb +3 -0
  454. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/class_methods.rb +50 -0
  455. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb +183 -0
  456. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern.rb +36 -0
  457. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins/aliases.rb +7 -0
  458. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins/has_awesome_print_inspect/concern.rb +46 -0
  459. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins/has_awesome_print_inspect.rb +3 -0
  460. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins/has_inspect/commands/generate_inspect_output.rb +77 -0
  461. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins/has_inspect/commands.rb +3 -0
  462. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins/has_inspect/concern.rb +41 -0
  463. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins/has_inspect.rb +4 -0
  464. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins.rb +5 -0
  465. data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/has_step/to_kwargs/middleware.rb → has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data.rb} +9 -7
  466. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/commands/is_message.rb +49 -0
  467. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/commands.rb +3 -0
  468. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern/class_methods.rb +52 -0
  469. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern/instance_methods.rb +116 -0
  470. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern.rb +36 -0
  471. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/plugins/aliases.rb +7 -0
  472. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/plugins/has_awesome_print_inspect/concern.rb +46 -0
  473. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/plugins/has_awesome_print_inspect.rb +3 -0
  474. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/plugins/has_inspect/concern.rb +38 -0
  475. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/plugins/has_inspect.rb +3 -0
  476. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/plugins.rb +5 -0
  477. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message.rb +27 -0
  478. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/commands/is_status.rb +49 -0
  479. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/commands.rb +3 -0
  480. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern/class_methods.rb +52 -0
  481. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern/instance_methods.rb +140 -0
  482. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern.rb +36 -0
  483. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/aliases.rb +7 -0
  484. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/has_awesome_print_inspect/concern.rb +46 -0
  485. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/has_awesome_print_inspect.rb +3 -0
  486. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/has_inspect/concern.rb +38 -0
  487. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/has_inspect.rb +3 -0
  488. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins.rb +5 -0
  489. data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/marks_result_status_as_checked/middleware.rb → has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status.rb} +9 -7
  490. data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/has_jsend_status_and_attributes/errors.rb → has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/exceptions.rb} +8 -4
  491. data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/has_jsend_status_and_attributes → has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes}/middleware.rb +9 -7
  492. data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/has_jsend_status_and_attributes/structs/jsend_attributes.rb → has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/structs/j_send_attributes.rb} +3 -3
  493. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/structs.rb +3 -0
  494. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes.rb +8 -0
  495. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_stubbed_result_invocations_counter/concern.rb +30 -0
  496. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_stubbed_result_invocations_counter/middleware.rb +38 -0
  497. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_stubbed_result_invocations_counter.rb +4 -0
  498. data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/raises_on_not_checked_result_status/errors.rb → has_j_send_result/entities/result/plugins/raises_on_not_checked_result_status/exceptions.rb} +3 -3
  499. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/raises_on_not_checked_result_status/middleware.rb +47 -0
  500. data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/raises_on_not_checked_result_status.rb +1 -1
  501. data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins.rb +15 -0
  502. data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result.rb +1 -1
  503. data/lib/convenient_service/service/plugins/has_j_send_result/exceptions.rb +21 -0
  504. data/lib/convenient_service/service/plugins/has_j_send_result.rb +8 -0
  505. data/lib/convenient_service/service/plugins/{has_result_params_validations → has_j_send_result_params_validations}/using_active_model_validations/concern.rb +1 -1
  506. data/lib/convenient_service/service/plugins/{has_result_params_validations → has_j_send_result_params_validations}/using_active_model_validations/middleware.rb +4 -2
  507. data/lib/convenient_service/service/plugins/{has_result_params_validations → has_j_send_result_params_validations}/using_dry_validation/concern.rb +1 -1
  508. data/lib/convenient_service/service/plugins/{has_result_params_validations → has_j_send_result_params_validations}/using_dry_validation/middleware.rb +5 -3
  509. data/lib/convenient_service/service/plugins/{has_result_short_syntax → has_j_send_result_short_syntax}/concern.rb +1 -1
  510. data/lib/convenient_service/service/plugins/{has_result_short_syntax → has_j_send_result_short_syntax}/error/commands/assert_args_count_lower_than_three.rb +2 -2
  511. data/lib/convenient_service/service/plugins/{has_result_short_syntax → has_j_send_result_short_syntax}/error/commands/assert_either_args_or_kwargs_are_passed.rb +2 -2
  512. data/lib/convenient_service/service/plugins/{has_result_short_syntax/error/errors.rb → has_j_send_result_short_syntax/error/exceptions.rb} +4 -4
  513. data/lib/convenient_service/service/plugins/{has_result_short_syntax → has_j_send_result_short_syntax}/error/middleware.rb +5 -3
  514. data/lib/convenient_service/service/plugins/{has_result_short_syntax → has_j_send_result_short_syntax}/error.rb +1 -1
  515. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/commands/assert_kwargs_contain_only_j_send_keys.rb +53 -0
  516. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/commands.rb +3 -0
  517. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/exceptions.rb +29 -0
  518. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/middleware.rb +23 -0
  519. data/lib/convenient_service/service/plugins/{has_result_short_syntax → has_j_send_result_short_syntax}/failure.rb +1 -1
  520. data/lib/convenient_service/service/plugins/{has_result_short_syntax → has_j_send_result_short_syntax}/success/commands/refute_kwargs_contain_data_and_extra_keys.rb +2 -2
  521. data/lib/convenient_service/service/plugins/{has_result_short_syntax/success/errors.rb → has_j_send_result_short_syntax/success/exceptions.rb} +3 -3
  522. data/lib/convenient_service/service/plugins/{has_result_short_syntax → has_j_send_result_short_syntax}/success/middleware.rb +5 -3
  523. data/lib/convenient_service/service/plugins/{has_result_short_syntax → has_j_send_result_short_syntax}/success.rb +1 -1
  524. data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax.rb +6 -0
  525. data/lib/convenient_service/service/plugins/{has_result_status_check_short_syntax → has_j_send_result_status_check_short_syntax}/concern.rb +17 -1
  526. data/lib/convenient_service/service/plugins/has_j_send_result_status_check_short_syntax.rb +3 -0
  527. data/lib/convenient_service/service/plugins/has_mermaid_flowchart/concern.rb +24 -0
  528. data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands/generate_lines.rb +94 -0
  529. data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands/generate_method_step_lines.rb +115 -0
  530. data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands/generate_result_lines.rb +105 -0
  531. data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands/generate_service_lines.rb +88 -0
  532. data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands/generate_service_step_lines.rb +127 -0
  533. data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands.rb +7 -0
  534. data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code.rb +90 -0
  535. data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/settings.rb +144 -0
  536. data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/template.rb +85 -0
  537. data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities.rb +5 -0
  538. data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/templates/flowchart.html.erb +95 -0
  539. data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart.rb +108 -0
  540. data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities.rb +3 -0
  541. data/lib/convenient_service/service/plugins/has_mermaid_flowchart.rb +4 -0
  542. data/lib/convenient_service/service/plugins/has_result/concern.rb +17 -6
  543. data/lib/convenient_service/service/plugins/has_result/exceptions.rb +21 -0
  544. data/lib/convenient_service/service/plugins/has_result.rb +1 -5
  545. data/lib/convenient_service/service/plugins/raises_on_double_result/{errors.rb → exceptions.rb} +2 -2
  546. data/lib/convenient_service/service/plugins/raises_on_double_result/middleware.rb +11 -9
  547. data/lib/convenient_service/service/plugins/raises_on_double_result.rb +1 -1
  548. data/lib/convenient_service/service/plugins/raises_on_not_result_return_value/exceptions.rb +24 -0
  549. data/lib/convenient_service/service/plugins/raises_on_not_result_return_value/middleware.rb +25 -0
  550. data/lib/convenient_service/service/plugins/raises_on_not_result_return_value.rb +4 -0
  551. data/lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/commands/format_backtrace.rb +1 -1
  552. data/lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/commands/format_exception.rb +11 -10
  553. data/lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/middleware.rb +51 -10
  554. data/lib/convenient_service/service/plugins/sets_parent_to_foreign_result/middleware.rb +56 -0
  555. data/lib/convenient_service/service/plugins/sets_parent_to_foreign_result.rb +3 -0
  556. data/lib/convenient_service/service/plugins/wraps_result_in_db_transaction/middleware.rb +3 -1
  557. data/lib/convenient_service/service/plugins.rb +14 -6
  558. data/lib/convenient_service/support/abstract_method/{errors.rb → exceptions.rb} +2 -2
  559. data/lib/convenient_service/support/abstract_method.rb +2 -2
  560. data/lib/convenient_service/support/arguments.rb +3 -3
  561. data/lib/convenient_service/support/cache/constants.rb +36 -0
  562. data/lib/convenient_service/support/cache/entities/caches/array/entities/pair.rb +52 -0
  563. data/lib/convenient_service/support/cache/entities/caches/array/entities.rb +3 -0
  564. data/lib/convenient_service/support/cache/entities/caches/array.rb +135 -0
  565. data/lib/convenient_service/support/cache/entities/caches/base.rb +112 -0
  566. data/lib/convenient_service/support/cache/entities/caches/hash.rb +113 -0
  567. data/lib/convenient_service/support/cache/entities/caches/thread_safe_array.rb +89 -0
  568. data/lib/convenient_service/support/cache/entities/caches.rb +8 -0
  569. data/lib/convenient_service/support/cache/entities/key.rb +102 -0
  570. data/lib/convenient_service/support/cache/entities.rb +4 -0
  571. data/lib/convenient_service/support/cache/exceptions.rb +34 -0
  572. data/lib/convenient_service/support/cache.rb +16 -143
  573. data/lib/convenient_service/support/castable/{errors.rb → exceptions.rb} +3 -3
  574. data/lib/convenient_service/support/castable.rb +2 -2
  575. data/lib/convenient_service/support/command.rb +42 -3
  576. data/lib/convenient_service/support/copyable.rb +7 -23
  577. data/lib/convenient_service/support/counter.rb +211 -0
  578. data/lib/convenient_service/support/dependency_container/commands/assert_valid_container.rb +33 -0
  579. data/lib/convenient_service/support/dependency_container/commands/assert_valid_method.rb +58 -0
  580. data/lib/convenient_service/support/dependency_container/commands/assert_valid_scope.rb +5 -4
  581. data/lib/convenient_service/support/dependency_container/commands/define_entry.rb +49 -0
  582. data/lib/convenient_service/support/dependency_container/commands.rb +3 -0
  583. data/lib/convenient_service/support/dependency_container/container.rb +23 -0
  584. data/lib/convenient_service/support/dependency_container/entities/method.rb +49 -12
  585. data/lib/convenient_service/support/dependency_container/entities/method_collection.rb +3 -3
  586. data/lib/convenient_service/support/dependency_container/entry.rb +22 -0
  587. data/lib/convenient_service/support/dependency_container/{errors.rb → exceptions.rb} +6 -6
  588. data/lib/convenient_service/support/dependency_container/export.rb +4 -4
  589. data/lib/convenient_service/support/dependency_container/import.rb +8 -5
  590. data/lib/convenient_service/support/dependency_container.rb +4 -1
  591. data/lib/convenient_service/support/finite_loop.rb +43 -8
  592. data/lib/convenient_service/support/gems/logger.rb +37 -0
  593. data/lib/convenient_service/support/gems/paint.rb +37 -0
  594. data/lib/convenient_service/support/gems.rb +2 -0
  595. data/lib/convenient_service/support/middleware/stack_builder.rb +1 -1
  596. data/lib/convenient_service/support/not_passed.rb +4 -3
  597. data/lib/convenient_service/support/ruby.rb +31 -0
  598. data/lib/convenient_service/support/safe_method.rb +65 -0
  599. data/lib/convenient_service/support/thread_safe_counter.rb +128 -0
  600. data/lib/convenient_service/support/undefined.rb +4 -3
  601. data/lib/convenient_service/support/unique_value.rb +69 -0
  602. data/lib/convenient_service/support.rb +5 -0
  603. data/lib/convenient_service/utils/array/contain_exactly.rb +1 -5
  604. data/lib/convenient_service/utils/array/{errors.rb → exceptions.rb} +2 -2
  605. data/lib/convenient_service/utils/array/find_last.rb +1 -1
  606. data/lib/convenient_service/utils/array/find_yield.rb +1 -1
  607. data/lib/convenient_service/utils/array/limited_push.rb +54 -0
  608. data/lib/convenient_service/utils/array/merge.rb +3 -3
  609. data/lib/convenient_service/utils/array.rb +6 -1
  610. data/lib/convenient_service/utils/class/display_name.rb +49 -0
  611. data/lib/convenient_service/utils/class.rb +20 -0
  612. data/lib/convenient_service/utils/hash/assert_valid_keys.rb +50 -0
  613. data/lib/convenient_service/utils/hash/except.rb +1 -1
  614. data/lib/convenient_service/utils/hash/triple_equality_compare.rb +51 -0
  615. data/lib/convenient_service/utils/hash.rb +10 -0
  616. data/lib/convenient_service/utils/method/defined.rb +50 -6
  617. data/lib/convenient_service/utils/module/class_method_defined.rb +22 -2
  618. data/lib/convenient_service/utils/module/get_own_instance_method.rb +3 -0
  619. data/lib/convenient_service/utils/module/instance_method_defined.rb +22 -2
  620. data/lib/convenient_service/utils/object/clamp_class.rb +77 -0
  621. data/lib/convenient_service/utils/object/duck_class.rb +112 -0
  622. data/lib/convenient_service/utils/object/memoize_including_falsy_values.rb +1 -1
  623. data/lib/convenient_service/utils/object.rb +19 -1
  624. data/lib/convenient_service/utils/string/truncate.rb +69 -0
  625. data/lib/convenient_service/utils/string.rb +5 -0
  626. data/lib/convenient_service/utils.rb +21 -0
  627. data/lib/convenient_service/version.rb +1 -1
  628. data/lib/convenient_service.rb +16 -3
  629. data/minitest.rb +30 -0
  630. metadata +613 -150
  631. data/lib/convenient_service/common/plugins/caches_constructor_params/concern.rb +0 -22
  632. data/lib/convenient_service/common/plugins/caches_constructor_params/entities/constructor_params.rb +0 -34
  633. data/lib/convenient_service/common/plugins/caches_constructor_params/entities.rb +0 -3
  634. data/lib/convenient_service/common/plugins/caches_constructor_params/middleware.rb +0 -17
  635. data/lib/convenient_service/common/plugins/caches_constructor_params.rb +0 -5
  636. data/lib/convenient_service/core/class_methods.rb +0 -81
  637. data/lib/convenient_service/core/entities/classic_middleware.rb +0 -32
  638. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/chain.rb +0 -71
  639. data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware.rb +0 -114
  640. data/lib/convenient_service/core/entities/config/errors.rb +0 -27
  641. data/lib/convenient_service/core/instance_methods.rb +0 -54
  642. data/lib/convenient_service/error.rb +0 -16
  643. data/lib/convenient_service/factories/arguments.rb +0 -43
  644. data/lib/convenient_service/factories/results.rb +0 -214
  645. data/lib/convenient_service/factories/services.rb +0 -229
  646. data/lib/convenient_service/factories/step/instance.rb +0 -42
  647. data/lib/convenient_service/factories/step.rb +0 -3
  648. data/lib/convenient_service/factories/steps.rb +0 -126
  649. data/lib/convenient_service/factories.rb +0 -22
  650. data/lib/convenient_service/factory.rb +0 -21
  651. data/lib/convenient_service/rspec/helpers/custom/ignoring_error.rb +0 -32
  652. data/lib/convenient_service/rspec/matchers/custom/results/base/commands/find_result_method_step.rb +0 -74
  653. data/lib/convenient_service/rspec/matchers/custom/results/base/commands/find_result_result_method_step.rb +0 -66
  654. data/lib/convenient_service/rspec/matchers/custom/results/base/commands/find_result_service_step.rb +0 -48
  655. data/lib/convenient_service/rspec/matchers/custom/results/base/commands/generate_expected_step_part.rb +0 -42
  656. data/lib/convenient_service/rspec/matchers/custom/results/base/commands/generate_got_step_part.rb +0 -42
  657. data/lib/convenient_service/rspec/matchers/custom/results/base/commands/match_result_step.rb +0 -89
  658. data/lib/convenient_service/rspec/matchers/custom/results/base/commands.rb +0 -10
  659. data/lib/convenient_service/service/plugins/can_have_result_step/middleware.rb +0 -43
  660. data/lib/convenient_service/service/plugins/can_have_result_step.rb +0 -3
  661. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_caller.rb +0 -74
  662. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_key.rb +0 -78
  663. data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_name.rb +0 -78
  664. data/lib/convenient_service/service/plugins/can_have_steps/entities/service/class_methods.rb +0 -32
  665. data/lib/convenient_service/service/plugins/can_have_steps/entities/step/errors.rb +0 -23
  666. data/lib/convenient_service/service/plugins/can_have_stubbed_result/concern.rb +0 -51
  667. data/lib/convenient_service/service/plugins/can_have_stubbed_result/middleware.rb +0 -36
  668. data/lib/convenient_service/service/plugins/can_have_stubbed_result.rb +0 -4
  669. data/lib/convenient_service/service/plugins/has_result/concern/instance_methods.rb +0 -48
  670. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result/initialize/middleware.rb +0 -27
  671. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result/initialize.rb +0 -3
  672. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result/to_kwargs/middleware.rb +0 -25
  673. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result/to_kwargs.rb +0 -3
  674. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result.rb +0 -5
  675. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/commands/cast_jsend_attributes.rb +0 -37
  676. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/commands.rb +0 -3
  677. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/code/concern/instance_methods.rb +0 -65
  678. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/data/class_methods.rb +0 -32
  679. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/data.rb +0 -74
  680. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/message/class_methods.rb +0 -34
  681. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/message.rb +0 -45
  682. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/status/class_methods.rb +0 -34
  683. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/status.rb +0 -77
  684. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/structs.rb +0 -3
  685. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes.rb +0 -8
  686. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_result_short_syntax/concern.rb +0 -62
  687. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_result_short_syntax.rb +0 -3
  688. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_step/initialize/middleware.rb +0 -27
  689. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_step/initialize.rb +0 -3
  690. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_step/to_kwargs.rb +0 -3
  691. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_step.rb +0 -5
  692. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/marks_result_status_as_checked.rb +0 -3
  693. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/raises_on_not_checked_result_status/middleware.rb +0 -33
  694. data/lib/convenient_service/service/plugins/has_result/entities/result/plugins.rb +0 -10
  695. data/lib/convenient_service/service/plugins/has_result/errors.rb +0 -34
  696. data/lib/convenient_service/service/plugins/has_result/middleware.rb +0 -19
  697. data/lib/convenient_service/service/plugins/has_result_short_syntax/failure/commands/refute_kwargs_contain_data_and_extra_keys.rb +0 -29
  698. data/lib/convenient_service/service/plugins/has_result_short_syntax/failure/errors.rb +0 -28
  699. data/lib/convenient_service/service/plugins/has_result_short_syntax/failure/middleware.rb +0 -19
  700. data/lib/convenient_service/service/plugins/has_result_short_syntax/success/commands.rb +0 -3
  701. data/lib/convenient_service/service/plugins/has_result_short_syntax.rb +0 -6
  702. data/lib/convenient_service/service/plugins/has_result_status_check_short_syntax.rb +0 -3
  703. data/lib/convenient_service/services/run_method_in_organizer.rb +0 -28
  704. data/lib/convenient_service/services/run_own_method_in_organizer.rb +0 -64
  705. data/lib/convenient_service/support/cache/key.rb +0 -100
  706. /data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/can_recalculate_result.rb +0 -0
  707. /data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_inspect.rb +0 -0
  708. /data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/has_jsend_status_and_attributes → has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes}/entities.rb +0 -0
  709. /data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities.rb +0 -0
  710. /data/lib/convenient_service/service/plugins/{has_result_params_validations → has_j_send_result_params_validations}/using_active_model_validations.rb +0 -0
  711. /data/lib/convenient_service/service/plugins/{has_result_params_validations → has_j_send_result_params_validations}/using_dry_validation.rb +0 -0
  712. /data/lib/convenient_service/service/plugins/{has_result_short_syntax → has_j_send_result_short_syntax}/error/commands.rb +0 -0
  713. /data/lib/convenient_service/service/plugins/{has_result_short_syntax/failure → has_j_send_result_short_syntax/success}/commands.rb +0 -0
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "concern/class_methods"
4
+ require_relative "concern/instance_methods"
5
+
6
+ module ConvenientService
7
+ module Core
8
+ module Entities
9
+ class Config
10
+ module Entities
11
+ class MethodMiddlewares
12
+ module Entities
13
+ module Middlewares
14
+ class Chain < Middlewares::Base
15
+ module Concern
16
+ include Support::Concern
17
+
18
+ included do |middleware_class|
19
+ middleware_class.include InstanceMethods
20
+
21
+ middleware_class.extend ClassMethods
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ConvenientService
4
+ module Core
5
+ module Entities
6
+ class Config
7
+ module Entities
8
+ class MethodMiddlewares
9
+ module Entities
10
+ module Middlewares
11
+ ##
12
+ # @abstract Subclass and override `#next`.
13
+ #
14
+ # @internal
15
+ # NOTE: Do NOT pollute the interface of this class until really needed.
16
+ # Avoid even pollution of private methods.
17
+ # This way there is a lower risk that a plugin developer accidentally overwrites an internal middleware behavior.
18
+ # https://github.com/Ibsciss/ruby-middleware#a-basic-example
19
+ #
20
+ class Chain < Middlewares::Base
21
+ module Entities
22
+ ##
23
+ # @internal
24
+ # NOTE: Do NOT pollute the interface of this class until really needed.
25
+ #
26
+ class MethodChain
27
+ ##
28
+ # @param stack [#call<Hash>]
29
+ # @param env [Hash]
30
+ # @return [void]
31
+ #
32
+ def initialize(stack:, env: {})
33
+ @stack = stack
34
+ @env = env
35
+ end
36
+
37
+ ##
38
+ # @param args [Array<Object>]
39
+ # @param kwargs [Hash{Symbol => Object}]
40
+ # @param block [Proc, nil]
41
+ # @return [Object] Can be any type.
42
+ #
43
+ # @internal
44
+ # TODO: Enforce to always pass args, kwargs, block.
45
+ #
46
+ def next(*args, **kwargs, &block)
47
+ stack.call(env.merge(args: args, kwargs: kwargs, block: block))
48
+ end
49
+
50
+ ##
51
+ # @param other [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Chain, Object]
52
+ # @return [Boolean]
53
+ #
54
+ def ==(other)
55
+ return unless other.instance_of?(self.class)
56
+
57
+ return false if stack != other.stack
58
+ return false if env != other.env
59
+
60
+ true
61
+ end
62
+
63
+ protected
64
+
65
+ ##
66
+ # @!attribute [r] stack
67
+ # @return [#call<Hash>]
68
+ #
69
+ attr_reader :stack
70
+
71
+ ##
72
+ # @!attribute [r] env
73
+ # @return [Hash]
74
+ #
75
+ attr_reader :env
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "entities/method_chain"
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "chain/commands"
4
+ require_relative "chain/concern"
5
+ require_relative "chain/entities"
6
+
7
+ module ConvenientService
8
+ module Core
9
+ module Entities
10
+ class Config
11
+ module Entities
12
+ class MethodMiddlewares
13
+ module Entities
14
+ module Middlewares
15
+ ##
16
+ # @abstract Subclass and override `#next`.
17
+ #
18
+ # @internal
19
+ # NOTE: Do NOT pollute the interface of this class until really needed.
20
+ # Avoid even pollution of private methods.
21
+ # This way there is a lower risk that a plugin developer accidentally overwrites an internal middleware behavior.
22
+ # https://github.com/Ibsciss/ruby-middleware#a-basic-example
23
+ #
24
+ class Chain < Middlewares::Base
25
+ include Concern
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ConvenientService
4
+ module Core
5
+ module Entities
6
+ class Config
7
+ module Entities
8
+ class MethodMiddlewares
9
+ module Entities
10
+ module Middlewares
11
+ ##
12
+ # @abstract Subclass and override `#call`.
13
+ #
14
+ # @internal
15
+ # NOTE: Do NOT pollute the interface of this class until really needed.
16
+ # Avoid even pollution of private methods.
17
+ # This way there is a lower risk that a plugin developer accidentally overwrites an internal middleware behavior.
18
+ # https://github.com/Ibsciss/ruby-middleware#a-basic-example
19
+ #
20
+ class Classic < Middlewares::Base
21
+ ##
22
+ # @return [Object] Can be any type.
23
+ #
24
+ def call(env)
25
+ stack.call(env)
26
+ end
27
+
28
+ ##
29
+ # @return [#call<Hash>]
30
+ #
31
+ def stack
32
+ @__stack__
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "middlewares/base"
4
+
5
+ require_relative "middlewares/classic"
6
+ require_relative "middlewares/chain"
@@ -7,6 +7,10 @@ module ConvenientService
7
7
  module Entities
8
8
  class MethodMiddlewares
9
9
  module Entities
10
+ ##
11
+ # @internal
12
+ # TODO: Better error explanations.
13
+ #
10
14
  class Stack
11
15
  ##
12
16
  # @overload initialize(name:)
@@ -46,10 +50,10 @@ module ConvenientService
46
50
  end
47
51
 
48
52
  ##
49
- # @param index_or_middleware [Integer, ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
50
- # @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
51
- # @param args [Array]
52
- # @param block [Proc]
53
+ # @param index_or_middleware [Integer, ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base]
54
+ # @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base]
55
+ # @param args [Array<Object>]
56
+ # @param block [Proc, nil]
53
57
  # @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
54
58
  #
55
59
  # @see https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L88
@@ -67,10 +71,10 @@ module ConvenientService
67
71
  alias_method :insert_before, :insert
68
72
 
69
73
  ##
70
- # @param index_or_middleware [Integer, ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
71
- # @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
72
- # @param args [Array]
73
- # @param block [Proc]
74
+ # @param index_or_middleware [Integer, ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base]
75
+ # @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base]
76
+ # @param args [Array<Object>]
77
+ # @param block [Proc, nil]
74
78
  # @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
75
79
  #
76
80
  # @see https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L97
@@ -82,9 +86,9 @@ module ConvenientService
82
86
  end
83
87
 
84
88
  ##
85
- # @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
86
- # @param args [Array]
87
- # @param block [Proc]
89
+ # @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base]
90
+ # @param args [Array<Object>]
91
+ # @param block [Proc, nil]
88
92
  # @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
89
93
  #
90
94
  # @see https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L104
@@ -96,9 +100,9 @@ module ConvenientService
96
100
  end
97
101
 
98
102
  ##
99
- # @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
100
- # @param args [Array]
101
- # @param block [Proc]
103
+ # @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base]
104
+ # @param args [Array<Object>]
105
+ # @param block [Proc, nil]
102
106
  # @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
103
107
  #
104
108
  # @see https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L111
@@ -110,10 +114,10 @@ module ConvenientService
110
114
  end
111
115
 
112
116
  ##
113
- # @param index_or_middleware [Integer, ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
114
- # @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
115
- # @param args [Array]
116
- # @param block [Proc]
117
+ # @param index_or_middleware [Integer, ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base]
118
+ # @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base]
119
+ # @param args [Array<Object>]
120
+ # @param block [Proc, nil]
117
121
  # @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
118
122
  #
119
123
  # @see https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L118
@@ -125,7 +129,7 @@ module ConvenientService
125
129
  end
126
130
 
127
131
  ##
128
- # @param index_or_middleware [Integer, ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
132
+ # @param index_or_middleware [Integer, ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base]
129
133
  # @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
130
134
  #
131
135
  # @see https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L126
@@ -137,9 +141,9 @@ module ConvenientService
137
141
  end
138
142
 
139
143
  ##
140
- # @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware]
141
- # @param args [Array]
142
- # @param block [Proc]
144
+ # @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base]
145
+ # @param args [Array<Object>]
146
+ # @param block [Proc, nil]
143
147
  # @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
144
148
  #
145
149
  # @see https://github.com/marian13/ruby-middleware/blob/v0.4.2/lib/middleware/builder.rb#L76
@@ -150,6 +154,37 @@ module ConvenientService
150
154
  self
151
155
  end
152
156
 
157
+ ##
158
+ # @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base]
159
+ # @param args [Array<Object>]
160
+ # @param block [Proc, nil]
161
+ # @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
162
+ #
163
+ # @note `observe` exists only for testing purposes. Do NOT use it in production code.
164
+ #
165
+ # @internal
166
+ # TODO: Raise if middleware is NOT used yet.
167
+ #
168
+ def observe(middleware, *args, &block)
169
+ plain_stack.replace(middleware, middleware.observable, *args, &block)
170
+
171
+ self
172
+ end
173
+
174
+ ##
175
+ # @param middleware [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base]
176
+ # @param args [Array<Object>]
177
+ # @param block [Proc, nil]
178
+ # @return [ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Stack]
179
+ #
180
+ # @note `use_and_observe` exists only for testing purposes. Do NOT use it in production code.
181
+ #
182
+ def use_and_observe(middleware, *args, &block)
183
+ plain_stack.use(middleware.observable, *args, &block)
184
+
185
+ self
186
+ end
187
+
153
188
  ##
154
189
  # @return [Boolean]
155
190
  #
@@ -170,7 +205,7 @@ module ConvenientService
170
205
  end
171
206
 
172
207
  ##
173
- # @return [Array<ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middleware>]
208
+ # @return [Array<ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base>]
174
209
  #
175
210
  def to_a
176
211
  plain_stack.to_a
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "entities/caller"
4
- require_relative "entities/chain"
5
4
  require_relative "entities/container"
6
- require_relative "entities/middleware"
5
+ require_relative "entities/middleware_creators"
6
+ require_relative "entities/middlewares"
7
7
  require_relative "entities/stack"
@@ -63,7 +63,7 @@ module ConvenientService
63
63
  end
64
64
 
65
65
  ##
66
- # @note: Works in a similar way as `Kernel.require`.
66
+ # @note Works in a similar way as `Kernel.require`.
67
67
  #
68
68
  # @return [Boolean]
69
69
  #
@@ -93,7 +93,7 @@ module ConvenientService
93
93
  # NOTE: Consider to remove when support for Ruby 2.7 is dropped.
94
94
  #
95
95
  def resolve_super_method(entity)
96
- klass.commit_config!
96
+ klass.commit_config!(trigger: Constants::Triggers::RESOLVE_METHOD_MIDDLEWARES_SUPER_METHOD)
97
97
 
98
98
  container.resolve_super_method(method, entity)
99
99
  end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ConvenientService
4
+ module Core
5
+ module Entities
6
+ class Config
7
+ module Exceptions
8
+ class ConfigIsCommitted < ::ConvenientService::Exception
9
+ ##
10
+ # @param config [ConvenientService::Core::Entities::Config]
11
+ # @return [void]
12
+ #
13
+ def initialize(config:)
14
+ message = <<~TEXT
15
+ Config for `#{config.klass}` is already committed. Only uncommitted configs can be modified.
16
+
17
+ Did you accidentally call `concerns(&configuration_block)` or `middlewares(method, scope: scope, &configuration_block)` after using any plugin, after calling `commit_config!`?
18
+ TEXT
19
+
20
+ super(message)
21
+ end
22
+ end
23
+
24
+ class TooManyCommitsFromMethodMissing < ::ConvenientService::Exception
25
+ ##
26
+ # @param config [ConvenientService::Core::Entities::Config]
27
+ # @return [void]
28
+ #
29
+ # @internal
30
+ # TODO: Create a troubleshooting page with possible reasons (preliminary RSpec mocks etc).
31
+ # Append a link to it to the error message.
32
+ #
33
+ def initialize(config:)
34
+ message = <<~TEXT
35
+ `#{config.klass}` config is committed too many times from `method_missing`.
36
+
37
+ In order to resolve this issue try to commit it manually before usage of any config-dependent method.
38
+
39
+ Example 1 (outside class):
40
+
41
+ # Commitment:
42
+ #{config.klass}.commit_config!
43
+
44
+ # Few lines later - usage:
45
+ #{config.klass}.result # or whatever method.
46
+
47
+ Example 2 (inside class):
48
+
49
+ class #{config.klass}
50
+ # ...
51
+ commit_config!
52
+
53
+ step :result # or any other method that becomes available after config commitment.
54
+ end
55
+ TEXT
56
+
57
+ super(message)
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "config/commands"
3
4
  require_relative "config/entities"
4
- require_relative "config/errors"
5
+ require_relative "config/exceptions"
5
6
 
6
7
  module ConvenientService
7
8
  module Core
@@ -57,13 +58,13 @@ module ConvenientService
57
58
  # @overload middlewares(method)
58
59
  # Returns all instance middlewares for particular method.
59
60
  # @param method [Symbol] Method name.
60
- # @return [Hash<Symbol, Hash<Symbol, ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares>>]
61
+ # @return [Hash{Symbol => Hash{Symbol => ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares}}]
61
62
  #
62
63
  # @overload middlewares(method, scope:)
63
64
  # Returns all scoped middlewares for particular method.
64
65
  # @param method [Symbol] Method name.
65
66
  # @param scope [:instance, :class]
66
- # @return [Hash<Symbol, Hash<Symbol, ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares>>]
67
+ # @return [Hash{Symbol => Hash{Symbol => ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares}}]
67
68
  #
68
69
  # @overload middlewares(method, &configuration_block)
69
70
  # Configures instance middlewares for particular method.
@@ -105,32 +106,54 @@ module ConvenientService
105
106
  @middlewares[scope][method] || Entities::MethodMiddlewares.new(scope: scope, method: method, klass: klass)
106
107
  end
107
108
 
109
+ ##
110
+ # @return [ConvenientService::Support::ThreadSafeCounter]
111
+ #
112
+ def method_missing_commits_counter
113
+ @method_missing_commits_counter ||= Support::ThreadSafeCounter.new(max_value: Constants::Commits::METHOD_MISSING_MAX_TRIES)
114
+ end
115
+
108
116
  ##
109
117
  # @return [Boolean]
110
118
  #
119
+ # @internal
120
+ # IMPORTANT:
121
+ # - Memoization of only `true` is intentional.
122
+ # - It is done for performance purposes.
123
+ # - It is OK to memoize only `true` since "uncommitment" of config is even theoretically NOT possible.
124
+ # - It is NOT possible to uninclude Ruby modules.
125
+ # - See `benchmark/has_committed_config/ips.rb`.
126
+ #
127
+ # IMPORTANT: `committed?` MUST be thread safe.
128
+ #
111
129
  def committed?
112
- concerns.included?
130
+ @committed ||= concerns.included?
113
131
  end
114
132
 
115
133
  ##
116
134
  # Commits config when called for the first time.
117
135
  # Does nothing for the subsequent calls.
118
136
  #
137
+ # @param trigger [ConvenientService::Support::UniqueValue]
119
138
  # @return [Boolean] true if called for the first time, false otherwise (similarly as Kernel#require).
120
139
  #
121
140
  # @see https://ruby-doc.org/core-3.1.2/Kernel.html#method-i-require
122
141
  #
123
- def commit!
124
- concerns.include!
142
+ # @internal
143
+ # IMPORTANT: `commit!` MUST be thread safe.
144
+ #
145
+ def commit!(trigger: Constants::Triggers::USER)
146
+ (committed? ? false : concerns.include!)
147
+ .tap { Commands::TrackMethodMissingCommitTrigger.call(config: self, trigger: trigger) }
125
148
  end
126
149
 
127
150
  private
128
151
 
129
152
  ##
130
- # @note: Config is committed either by `commit_config` or `method_missing` from `ConvenientService::Core::ClassMethods`.
153
+ # @note Config is committed either by `commit_config` or `method_missing` from `ConvenientService::Core::InstanceMethods` and `ConvenientService::Core::ClassMethods`.
131
154
  #
132
155
  # @return [void]
133
- # @raise [ConvenientService::Core::Entities::Config::Errors::ConfigIsCommitted]
156
+ # @raise [ConvenientService::Core::Entities::Config::Exceptions::ConfigIsCommitted]
134
157
  #
135
158
  # @internal
136
159
  # NOTE: Concerns must be included only once since Ruby does NOT allow to modify the order of modules in the inheritance chain.
@@ -139,7 +162,7 @@ module ConvenientService
139
162
  def assert_not_committed!
140
163
  return unless committed?
141
164
 
142
- raise Errors::ConfigIsCommitted.new(config: self)
165
+ raise Exceptions::ConfigIsCommitted.new(config: self)
143
166
  end
144
167
  end
145
168
  end
@@ -1,4 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "entities/classic_middleware"
4
3
  require_relative "entities/config"
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "core/instance_methods"
4
- require_relative "core/class_methods"
3
+ require_relative "core/concern"
5
4
 
5
+ require_relative "core/constants"
6
6
  require_relative "core/entities"
7
7
 
8
8
  require_relative "core/aliases"
@@ -11,9 +11,12 @@ module ConvenientService
11
11
  module Core
12
12
  include Support::Concern
13
13
 
14
- included do |service_class|
15
- service_class.include InstanceMethods
16
- service_class.extend ClassMethods
14
+ ##
15
+ # @internal
16
+ # TODO: Allow to include `Core` only to classes?
17
+ #
18
+ included do |entity_class|
19
+ entity_class.include Concern
17
20
  end
18
21
  end
19
22
  end
@@ -5,7 +5,7 @@
5
5
  #
6
6
  # @internal
7
7
  # https://github.com/marian13/convenient_service/wiki/Docs:-Dependencies
8
- #
8
+ ##
9
9
 
10
10
  ##
11
11
  # @internal
@@ -14,6 +14,13 @@
14
14
  #
15
15
  require "forwardable"
16
16
 
17
+ ##
18
+ # @internal
19
+ # - https://ruby-doc.org/stdlib-2.7.0/libdoc/erb/rdoc/ERB.html
20
+ # - https://github.com/ruby/erb
21
+ #
22
+ require "erb"
23
+
17
24
  ##
18
25
  # @internal
19
26
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/logger/rdoc/Logger.html
@@ -23,10 +30,10 @@ require "logger"
23
30
 
24
31
  ##
25
32
  # @internal
26
- # - https://ruby-doc.org/stdlib-2.7.0/libdoc/ostruct/rdoc/OpenStruct.html
27
- # - https://github.com/ruby/ostruct
33
+ # - https://ruby-doc.org/stdlib-2.7.0/libdoc/observer/rdoc/Observable.html
34
+ # - https://github.com/ruby/observer
28
35
  #
29
- require "ostruct"
36
+ require "observer"
30
37
 
31
38
  ##
32
39
  # @internal
@@ -42,3 +49,10 @@ require "rubygems"
42
49
  # - https://github.com/ruby/singleton
43
50
  #
44
51
  require "singleton"
52
+
53
+ ##
54
+ # @internal
55
+ # - https://ruby-doc.org/core-2.7.0/Mutex.html
56
+ # - https://docs.ruby-lang.org/en/2.1.0/Mutex.html
57
+ #
58
+ require "thread"