convenient_service 0.12.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dev/.tmuxinator.yml +4 -0
- data/.github/workflows/ci.yml +2 -0
- data/.gitignore +18 -0
- data/.vscode/CacheItsValue.code-snippets +15 -0
- data/.vscode/DelegateTo.code-snippets +15 -0
- data/.vscode/cache_its_value.code-snippets +17 -0
- data/.vscode/comparison.code-snippets +41 -0
- data/.vscode/delegate_to.code-snippets +20 -0
- data/Appraisals +24 -2
- data/CHANGELOG.md +183 -0
- data/Gemfile +11 -6
- data/README.md +11 -3
- data/ROADMAP.md +5 -1
- data/Taskfile.yml +260 -55
- data/benchmark/commit_config/ips.rb +18 -0
- data/benchmark/commit_config/profile.rb +30 -0
- data/benchmark/empty_service/ips.rb +123 -0
- data/benchmark/has_committed_config/ips.rb +78 -0
- data/benchmark/has_committed_config/profile.rb +30 -0
- data/convenient_service.gemspec +125 -4
- data/gemfiles/.gitkeep +0 -0
- data/lib/convenient_service/alias.rb +3 -0
- data/lib/convenient_service/aliases.rb +0 -4
- data/lib/convenient_service/common/plugins/assigns_attributes_in_constructor/using_active_model_attribute_assignment/middleware.rb +3 -1
- data/lib/convenient_service/common/plugins/caches_constructor_arguments/concern.rb +22 -0
- data/lib/convenient_service/common/plugins/caches_constructor_arguments/middleware.rb +22 -0
- data/lib/convenient_service/common/plugins/caches_constructor_arguments.rb +4 -0
- data/lib/convenient_service/common/plugins/caches_return_value/middleware.rb +12 -8
- data/lib/convenient_service/common/plugins/can_be_copied/concern.rb +22 -5
- data/lib/convenient_service/common/plugins/can_have_user_provided_entity/commands/find_or_create_entity.rb +9 -7
- data/lib/convenient_service/common/plugins/can_have_user_provided_entity/{errors.rb → exceptions.rb} +4 -4
- data/lib/convenient_service/common/plugins/can_have_user_provided_entity.rb +1 -1
- data/lib/convenient_service/common/plugins/can_utilize_finite_loop/concern.rb +40 -0
- data/lib/convenient_service/common/plugins/can_utilize_finite_loop/constants.rb +21 -0
- data/lib/convenient_service/common/plugins/can_utilize_finite_loop.rb +4 -0
- data/lib/convenient_service/common/plugins/has_around_callbacks/{errors.rb → exceptions.rb} +2 -2
- data/lib/convenient_service/common/plugins/has_around_callbacks/middleware.rb +9 -3
- data/lib/convenient_service/common/plugins/has_around_callbacks.rb +1 -1
- data/lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb +1 -1
- data/lib/convenient_service/common/plugins/has_callbacks/middleware.rb +7 -1
- data/lib/convenient_service/common/plugins/has_constructor/concern.rb +3 -4
- data/lib/convenient_service/common/plugins/has_constructor_without_initialize/concern.rb +1 -9
- data/lib/convenient_service/common/plugins/has_internals/entities/internals/plugins/has_cache/concern.rb +1 -1
- data/lib/convenient_service/common/plugins/has_j_send_result_duck_short_syntax/concern.rb +68 -0
- data/lib/convenient_service/common/plugins/has_j_send_result_duck_short_syntax.rb +3 -0
- data/lib/convenient_service/common/plugins/normalizes_env/middleware.rb +3 -1
- data/lib/convenient_service/common/plugins.rb +2 -1
- data/lib/convenient_service/configs/awesome_print_inspect/aliases.rb +7 -0
- data/lib/convenient_service/configs/awesome_print_inspect.rb +59 -0
- data/lib/convenient_service/configs/minimal.rb +67 -5
- data/lib/convenient_service/configs/standard/aliases.rb +9 -0
- data/lib/convenient_service/configs/standard/v1.rb +183 -0
- data/lib/convenient_service/configs/standard.rb +118 -30
- data/lib/convenient_service/core/aliases.rb +4 -5
- data/lib/convenient_service/core/concern/class_methods.rb +129 -0
- data/lib/convenient_service/core/concern/instance_methods.rb +76 -0
- data/lib/convenient_service/core/concern.rb +25 -0
- data/lib/convenient_service/core/entities/config/commands/track_method_missing_commit_trigger.rb +2 -2
- data/lib/convenient_service/core/entities/config/entities/concerns/entities/middleware/commands/cast_middleware.rb +2 -2
- data/lib/convenient_service/core/entities/config/entities/concerns/entities/middleware.rb +1 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller/commands/cast_caller.rb +2 -2
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller/concern/instance_methods.rb +9 -2
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller/constants.rb +26 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller.rb +1 -3
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/container/concern/instance_methods.rb +10 -3
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware_creators/base.rb +95 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware_creators/observable/entities/event.rb +95 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware_creators/observable/entities.rb +3 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware_creators/observable.rb +42 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware_creators/with.rb +50 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware_creators.rb +6 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/commands/create_observable_middleware.rb +104 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/commands.rb +3 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/concern/class_methods.rb +115 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/concern/instance_methods.rb +70 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/concern.rb +32 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/constants.rb +36 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/structs/intended_method.rb +23 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/structs.rb +3 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base.rb +26 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/commands/create_observable_middleware.rb +90 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/commands.rb +3 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/concern/class_methods.rb +37 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/concern/instance_methods.rb +115 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/concern.rb +32 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/entities/method_chain.rb +86 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain/entities.rb +3 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/chain.rb +34 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/classic.rb +42 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares.rb +6 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/stack.rb +46 -11
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities.rb +2 -3
- data/lib/convenient_service/core/entities/config/entities/method_middlewares.rb +1 -1
- data/lib/convenient_service/core/entities/config/{errors.rb → exceptions.rb} +3 -3
- data/lib/convenient_service/core/entities/config.rb +19 -6
- data/lib/convenient_service/core/entities.rb +0 -1
- data/lib/convenient_service/core.rb +7 -5
- data/lib/convenient_service/dependencies/built_in.rb +11 -4
- data/lib/convenient_service/dependencies/extractions/active_support_backtrace_cleaner/backtrace_cleaner.rb +149 -0
- data/lib/convenient_service/dependencies/extractions/active_support_backtrace_cleaner.rb +15 -0
- data/lib/convenient_service/dependencies/extractions/active_support_concern/concern.rb +4 -3
- data/lib/convenient_service/dependencies/extractions/active_support_concern.rb +4 -3
- data/lib/convenient_service/dependencies.rb +266 -25
- data/lib/convenient_service/examples/dry/gemfile/dry_service/config.rb +19 -21
- data/lib/convenient_service/examples/dry/gemfile/services/assert_file_exists.rb +2 -2
- data/lib/convenient_service/examples/dry/gemfile/services/assert_file_not_empty.rb +2 -2
- data/lib/convenient_service/examples/dry/gemfile/services/assert_node_available.rb +2 -2
- data/lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb +2 -2
- data/lib/convenient_service/examples/dry/gemfile/services/assert_valid_ruby_syntax.rb +2 -2
- data/lib/convenient_service/examples/dry/gemfile/services/format.rb +1 -1
- data/lib/convenient_service/examples/dry/gemfile/services/format_body.rb +1 -1
- data/lib/convenient_service/examples/dry/gemfile/services/format_gems_with_envs.rb +1 -1
- data/lib/convenient_service/examples/dry/gemfile/services/format_gems_without_envs.rb +1 -1
- data/lib/convenient_service/examples/dry/gemfile/services/format_header.rb +1 -1
- data/lib/convenient_service/examples/dry/gemfile/services/parse_content.rb +2 -2
- data/lib/convenient_service/examples/dry/gemfile/services/print_shell_command.rb +12 -5
- data/lib/convenient_service/examples/dry/gemfile/services/read_file_content.rb +2 -2
- data/lib/convenient_service/examples/dry/gemfile/services/{run_shell.rb → run_shell_command.rb} +11 -6
- data/lib/convenient_service/examples/dry/gemfile/services/strip_comments.rb +3 -3
- data/lib/convenient_service/examples/dry/gemfile/services.rb +3 -2
- data/lib/convenient_service/examples/dry/gemfile.rb +1 -1
- data/lib/convenient_service/examples/dry/v1/gemfile/dry_service/config.rb +47 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/dry_service.rb +3 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_file_exists.rb +31 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_file_not_empty.rb +31 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_node_available.rb +28 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_npm_package_available.rb +41 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_valid_ruby_syntax.rb +43 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format.rb +39 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format_body.rb +95 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format_gems_with_envs.rb +98 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format_gems_without_envs.rb +86 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format_header.rb +76 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/parse_content.rb +95 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/read_file_content.rb +33 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/run_shell_command.rb +43 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services/strip_comments.rb +111 -0
- data/lib/convenient_service/examples/dry/v1/gemfile/services.rb +17 -0
- data/lib/convenient_service/examples/dry/v1/gemfile.rb +27 -0
- data/lib/convenient_service/examples/rails/gemfile/rails_service/config.rb +28 -30
- data/lib/convenient_service/examples/rails/gemfile/services/assert_file_exists.rb +3 -3
- data/lib/convenient_service/examples/rails/gemfile/services/assert_file_not_empty.rb +3 -3
- data/lib/convenient_service/examples/rails/gemfile/services/assert_node_available.rb +2 -2
- data/lib/convenient_service/examples/rails/gemfile/services/assert_npm_package_available.rb +3 -3
- data/lib/convenient_service/examples/rails/gemfile/services/assert_valid_ruby_syntax.rb +2 -2
- data/lib/convenient_service/examples/rails/gemfile/services/format.rb +2 -2
- data/lib/convenient_service/examples/rails/gemfile/services/format_body.rb +1 -1
- data/lib/convenient_service/examples/rails/gemfile/services/format_gems_with_envs.rb +1 -1
- data/lib/convenient_service/examples/rails/gemfile/services/format_gems_without_envs.rb +1 -1
- data/lib/convenient_service/examples/rails/gemfile/services/format_header.rb +1 -1
- data/lib/convenient_service/examples/rails/gemfile/services/merge_sections.rb +3 -3
- data/lib/convenient_service/examples/rails/gemfile/services/parse_content.rb +3 -3
- data/lib/convenient_service/examples/rails/gemfile/services/print_shell_command.rb +12 -5
- data/lib/convenient_service/examples/rails/gemfile/services/read_file_content.rb +3 -3
- data/lib/convenient_service/examples/rails/gemfile/services/replace_file_content.rb +3 -3
- data/lib/convenient_service/examples/rails/gemfile/services/{run_shell.rb → run_shell_command.rb} +12 -7
- data/lib/convenient_service/examples/rails/gemfile/services/strip_comments.rb +4 -4
- data/lib/convenient_service/examples/rails/gemfile/services.rb +2 -2
- data/lib/convenient_service/examples/rails/gemfile.rb +1 -1
- data/lib/convenient_service/examples/rails/v1/gemfile/rails_service/config.rb +58 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/rails_service.rb +3 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_file_exists.rb +27 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_file_not_empty.rb +27 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_node_available.rb +28 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_npm_package_available.rb +37 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_valid_ruby_syntax.rb +37 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format.rb +68 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format_body.rb +81 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format_gems_with_envs.rb +84 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format_gems_without_envs.rb +72 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format_header.rb +70 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/merge_sections.rb +27 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/parse_content.rb +91 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/read_file_content.rb +29 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/replace_file_content.rb +39 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/run_shell_command.rb +38 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services/strip_comments.rb +109 -0
- data/lib/convenient_service/examples/rails/v1/gemfile/services.rb +20 -0
- data/lib/convenient_service/examples/rails/v1/gemfile.rb +27 -0
- data/lib/convenient_service/examples/standard/cowsay/services/build_cloud.rb +1 -1
- data/lib/convenient_service/examples/standard/cowsay/services/build_cow.rb +1 -1
- data/lib/convenient_service/examples/standard/cowsay/services/print.rb +1 -1
- data/lib/convenient_service/examples/standard/cowsay.rb +1 -1
- data/lib/convenient_service/examples/standard/date_time/services/safe_parse.rb +31 -0
- data/lib/convenient_service/examples/standard/date_time/services.rb +3 -0
- data/lib/convenient_service/examples/standard/date_time.rb +23 -0
- data/lib/convenient_service/examples/standard/factorial/services/calculate.rb +55 -0
- data/lib/convenient_service/examples/standard/factorial/services.rb +3 -0
- data/lib/convenient_service/examples/standard/factorial/utils/timeout/with_timeout.rb +50 -0
- data/lib/convenient_service/examples/standard/factorial/utils/timeout.rb +21 -0
- data/lib/convenient_service/examples/standard/factorial/utils.rb +3 -0
- data/lib/convenient_service/examples/standard/factorial.rb +24 -0
- data/lib/convenient_service/examples/standard/gemfile/services/assert_file_exists.rb +4 -4
- data/lib/convenient_service/examples/standard/gemfile/services/assert_file_not_empty.rb +4 -4
- data/lib/convenient_service/examples/standard/gemfile/services/assert_node_available.rb +2 -2
- data/lib/convenient_service/examples/standard/gemfile/services/assert_npm_package_available.rb +4 -4
- data/lib/convenient_service/examples/standard/gemfile/services/assert_valid_ruby_syntax.rb +2 -2
- data/lib/convenient_service/examples/standard/gemfile/services/format.rb +5 -5
- data/lib/convenient_service/examples/standard/gemfile/services/format_body.rb +1 -1
- data/lib/convenient_service/examples/standard/gemfile/services/format_gems_with_envs.rb +1 -1
- data/lib/convenient_service/examples/standard/gemfile/services/format_gems_without_envs.rb +1 -1
- data/lib/convenient_service/examples/standard/gemfile/services/format_header.rb +1 -1
- data/lib/convenient_service/examples/standard/gemfile/services/merge_sections.rb +5 -5
- data/lib/convenient_service/examples/standard/gemfile/services/parse_content.rb +4 -4
- data/lib/convenient_service/examples/standard/gemfile/services/print_shell_command.rb +15 -8
- data/lib/convenient_service/examples/standard/gemfile/services/read_file_content.rb +5 -5
- data/lib/convenient_service/examples/standard/gemfile/services/replace_file_content.rb +4 -4
- data/lib/convenient_service/examples/standard/gemfile/services/{run_shell.rb → run_shell_command.rb} +23 -6
- data/lib/convenient_service/examples/standard/gemfile/services/strip_comments.rb +3 -3
- data/lib/convenient_service/examples/standard/gemfile/services.rb +2 -2
- data/lib/convenient_service/examples/standard/gemfile.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/constants.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/entities/description.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/entities/format.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/entities/id.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/entities/logger.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/entities/request.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/entities/source.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/entities/tag.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/entities/title.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/services/apply_default_param_values.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/services/cast_params.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/services/extract_params_from_body.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/services/extract_params_from_path.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/services/filter_out_unpermitted_params.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/services/log_request_params.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/services/merge_params.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/services/prepare.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/services/validate_casted_params.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/services/validate_uncasted_params.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/utils/array/wrap.rb +2 -2
- data/lib/convenient_service/examples/standard/request_params/utils/array.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/utils/http/request/parse_body.rb +2 -2
- data/lib/convenient_service/examples/standard/request_params/utils/http/request/parse_path.rb +2 -2
- data/lib/convenient_service/examples/standard/request_params/utils/http/request.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/utils/integer/safe_parse.rb +2 -2
- data/lib/convenient_service/examples/standard/request_params/utils/integer.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/utils/json/safe_parse.rb +2 -2
- data/lib/convenient_service/examples/standard/request_params/utils/json.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/utils/object/blank.rb +2 -2
- data/lib/convenient_service/examples/standard/request_params/utils/object/present.rb +2 -2
- data/lib/convenient_service/examples/standard/request_params/utils/object.rb +1 -1
- data/lib/convenient_service/examples/standard/request_params/utils/url/valid.rb +47 -0
- data/lib/convenient_service/examples/standard/request_params/utils/url.rb +21 -0
- data/lib/convenient_service/examples/standard/request_params/utils.rb +1 -0
- data/lib/convenient_service/examples/standard/request_params.rb +1 -1
- data/lib/convenient_service/examples/standard/v1/cowsay/services/build_cloud.rb +44 -0
- data/lib/convenient_service/examples/standard/v1/cowsay/services/build_cow.rb +40 -0
- data/lib/convenient_service/examples/standard/v1/cowsay/services/print.rb +34 -0
- data/lib/convenient_service/examples/standard/v1/cowsay/services.rb +5 -0
- data/lib/convenient_service/examples/standard/v1/cowsay.rb +26 -0
- data/lib/convenient_service/examples/standard/v1/date_time/services/safe_parse.rb +33 -0
- data/lib/convenient_service/examples/standard/v1/date_time/services.rb +3 -0
- data/lib/convenient_service/examples/standard/v1/date_time.rb +25 -0
- data/lib/convenient_service/examples/standard/v1/factorial/services/calculate.rb +51 -0
- data/lib/convenient_service/examples/standard/v1/factorial/services.rb +3 -0
- data/lib/convenient_service/examples/standard/v1/factorial/utils/timeout/with_timeout.rb +52 -0
- data/lib/convenient_service/examples/standard/v1/factorial/utils/timeout.rb +23 -0
- data/lib/convenient_service/examples/standard/v1/factorial/utils.rb +3 -0
- data/lib/convenient_service/examples/standard/v1/factorial.rb +26 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_file_exists.rb +32 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_file_not_empty.rb +32 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_node_available.rb +28 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_npm_package_available.rb +50 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_valid_ruby_syntax.rb +41 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format.rb +82 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format_body.rb +85 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format_gems_with_envs.rb +88 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format_gems_without_envs.rb +76 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format_header.rb +68 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/merge_sections.rb +54 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/parse_content.rb +103 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/print_shell_command.rb +47 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/read_file_content.rb +41 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/replace_file_content.rb +50 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/run_shell_command.rb +52 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services/strip_comments.rb +113 -0
- data/lib/convenient_service/examples/standard/v1/gemfile/services.rb +20 -0
- data/lib/convenient_service/examples/standard/v1/gemfile.rb +26 -0
- data/lib/convenient_service/examples/standard/v1/request_params/constants.rb +17 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities/description.rb +42 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities/format.rb +42 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities/id.rb +49 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities/logger.rb +23 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities/request.rb +25 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities/source.rb +42 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities/tag.rb +42 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities/title.rb +42 -0
- data/lib/convenient_service/examples/standard/v1/request_params/entities.rb +11 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/apply_default_param_values.rb +28 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/cast_params.rb +40 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/extract_params_from_body.rb +72 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/extract_params_from_path.rb +64 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/filter_out_unpermitted_params.rb +28 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/log_request_params.rb +56 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/merge_params.rb +28 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/prepare.rb +67 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/validate_casted_params.rb +96 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services/validate_uncasted_params.rb +74 -0
- data/lib/convenient_service/examples/standard/v1/request_params/services.rb +13 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/array/wrap.rb +48 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/array.rb +23 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/http/request/parse_body.rb +44 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/http/request/parse_path.rb +42 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/http/request.rb +30 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/http.rb +3 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/integer/safe_parse.rb +33 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/integer.rb +27 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/json/safe_parse.rb +42 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/json.rb +23 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/object/blank.rb +36 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/object/present.rb +33 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/object.rb +28 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/url/valid.rb +49 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils/url.rb +23 -0
- data/lib/convenient_service/examples/standard/v1/request_params/utils.rb +8 -0
- data/lib/convenient_service/examples/standard/v1/request_params.rb +50 -0
- data/lib/convenient_service/exception.rb +16 -0
- data/lib/convenient_service/feature.rb +0 -1
- data/lib/convenient_service/logger.rb +69 -24
- data/lib/convenient_service/rspec/helpers/custom/ignoring_exception/exceptions.rb +27 -0
- data/lib/convenient_service/rspec/helpers/custom/ignoring_exception.rb +51 -0
- data/lib/convenient_service/rspec/helpers/custom/stub_service/entities/result_spec.rb +2 -2
- data/lib/convenient_service/rspec/helpers/custom/stub_service/entities/stubbed_service.rb +20 -16
- data/lib/convenient_service/rspec/helpers/custom/wrap_method/entities/wrapped_method.rb +110 -53
- data/lib/convenient_service/rspec/helpers/custom/wrap_method/{errors.rb → exceptions.rb} +2 -2
- data/lib/convenient_service/rspec/helpers/custom/wrap_method.rb +31 -7
- data/lib/convenient_service/rspec/helpers/custom.rb +1 -1
- data/lib/convenient_service/rspec/helpers/{ignoring_error.rb → ignoring_exception.rb} +3 -3
- data/lib/convenient_service/rspec/helpers.rb +2 -2
- data/lib/convenient_service/rspec/matchers/custom/be_descendant_of.rb +1 -1
- data/lib/convenient_service/rspec/matchers/custom/cache_its_value.rb +20 -0
- data/lib/convenient_service/rspec/matchers/custom/call_chain_next.rb +103 -2
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings/sub_matchers/return_its_value.rb +3 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings/sub_matchers/with_concrete_arguments.rb +1 -1
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings_collection/{errors.rb → exceptions.rb} +4 -4
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings_collection.rb +11 -11
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher.rb +5 -5
- data/lib/convenient_service/rspec/matchers/custom/delegate_to.rb +13 -3
- data/lib/convenient_service/rspec/matchers/custom/export.rb +9 -9
- data/lib/convenient_service/rspec/matchers/custom/have_abstract_method.rb +1 -1
- data/lib/convenient_service/rspec/matchers/custom/have_alias_method.rb +3 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/constants.rb +9 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/chain.rb +226 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_expected_code_part.rb +61 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_expected_data_part.rb +61 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_expected_message_part.rb +61 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_expected_parts.rb +121 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_expected_service_part.rb +61 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_expected_status_part.rb +68 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_expected_step_part.rb +61 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_got_parts.rb +98 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_got_service_part.rb +68 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands/generate_got_step_part.rb +68 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base/commands.rb +13 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/base.rb +207 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/error/commands/generate_got_jsend_attributes_part.rb +129 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/error/commands.rb +3 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/error.rb +34 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/failure/commands/generate_got_jsend_attributes_part.rb +129 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/failure/commands.rb +3 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/failure.rb +34 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/null.rb +147 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/success/commands/generate_got_jsend_attributes_part.rb +129 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/success/commands.rb +3 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers/success.rb +34 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/printers.rb +46 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands/validate_result.rb +121 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands/validate_result_code.rb +97 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands/validate_result_data.rb +97 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands/validate_result_message.rb +97 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands/validate_result_service.rb +81 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands/validate_result_status.rb +92 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands/validate_result_step.rb +127 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands/validate_result_type.rb +89 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator/commands.rb +10 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities/validator.rb +123 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/entities.rb +5 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/{errors.rb → exceptions.rb} +8 -2
- data/lib/convenient_service/rspec/matchers/custom/results/base.rb +112 -149
- data/lib/convenient_service/rspec/matchers/custom/results/be_error.rb +6 -1
- data/lib/convenient_service/rspec/matchers/custom/results/be_failure.rb +6 -1
- data/lib/convenient_service/rspec/matchers/custom/results/be_not_error.rb +7 -2
- data/lib/convenient_service/rspec/matchers/custom/results/be_not_failure.rb +7 -2
- data/lib/convenient_service/rspec/matchers/custom/results/be_not_success.rb +7 -2
- data/lib/convenient_service/rspec/matchers/custom/results/be_success.rb +6 -1
- data/lib/convenient_service/rspec/matchers/results/be_error.rb +3 -0
- data/lib/convenient_service/rspec/matchers/results/be_failure.rb +3 -0
- data/lib/convenient_service/rspec/matchers/results/be_not_error.rb +3 -0
- data/lib/convenient_service/rspec/matchers/results/be_not_failure.rb +3 -0
- data/lib/convenient_service/rspec/matchers/results/be_not_success.rb +3 -0
- data/lib/convenient_service/rspec/matchers/results/be_result.rb +31 -0
- data/lib/convenient_service/rspec/matchers/results/be_success.rb +3 -0
- data/lib/convenient_service/rspec/matchers/results.rb +4 -0
- data/lib/convenient_service/service/plugins/can_have_fallbacks/concern.rb +105 -0
- data/lib/convenient_service/service/plugins/can_have_fallbacks/exceptions.rb +36 -0
- data/lib/convenient_service/service/plugins/can_have_fallbacks/middleware.rb +36 -0
- data/lib/convenient_service/service/plugins/can_have_fallbacks.rb +5 -0
- data/lib/convenient_service/service/plugins/can_have_method_steps/middleware.rb +5 -24
- data/lib/convenient_service/service/plugins/can_have_steps/concern.rb +3 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method.rb +5 -5
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_factory.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb +2 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb +96 -26
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/alias.rb +2 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/base.rb +49 -7
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/proc.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/raw.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/reassignment.rb +2 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/usual.rb +2 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/directions/base.rb +27 -4
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/directions/input.rb +2 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/directions/output.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/base.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/key.rb +31 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/name.rb +31 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/{errors.rb → exceptions.rb} +81 -15
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/service/concern/class_methods.rb +46 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/service/concern/instance_methods.rb +64 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/service/concern.rb +28 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/service.rb +7 -30
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/commands/cast_params.rb +39 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/commands/extract_params.rb +2 -4
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb +229 -64
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/{errors.rb → exceptions.rb} +3 -3
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_completed/concern.rb +44 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_completed.rb +3 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/can_be_executed/middleware.rb +36 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/can_be_executed.rb +3 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/can_be_printed/middleware.rb +32 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/can_be_printed.rb +3 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/concern.rb +37 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step.rb +6 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step/can_be_executed/exceptions.rb +38 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step/can_be_executed/middleware.rb +72 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step/can_be_executed.rb +4 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step/concern.rb +30 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step.rb +5 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/concern.rb +97 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/middleware.rb +74 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/result.rb +3 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks.rb +4 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_parent_result/middleware.rb +4 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/has_awesome_print_inspect/concern.rb +45 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/has_awesome_print_inspect.rb +3 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/has_inspect/concern.rb +5 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins.rb +4 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/structs/params.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/middleware.rb +38 -9
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/commands/fetch_all_services_stubbed_results_cache.rb +30 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/commands/fetch_service_stubbed_results_cache.rb +43 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/commands/get_service_stubbed_result.rb +58 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/commands/set_service_stubbed_result.rb +66 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/commands.rb +6 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/concern.rb +46 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/container.rb +17 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results/middleware.rb +65 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_results.rb +6 -0
- data/lib/convenient_service/service/plugins/can_recalculate_result/concern.rb +1 -1
- data/lib/convenient_service/service/plugins/collects_services_in_exception/commands/extract_service_details.rb +64 -0
- data/lib/convenient_service/service/plugins/collects_services_in_exception/commands.rb +3 -0
- data/lib/convenient_service/service/plugins/collects_services_in_exception/constants.rb +16 -0
- data/lib/convenient_service/service/plugins/collects_services_in_exception/middleware.rb +50 -0
- data/lib/convenient_service/service/plugins/collects_services_in_exception.rb +5 -0
- data/lib/convenient_service/service/plugins/counts_stubbed_results_invocations/middleware.rb +24 -0
- data/lib/convenient_service/service/plugins/counts_stubbed_results_invocations.rb +3 -0
- data/lib/convenient_service/service/plugins/has_awesome_print_inspect/concern.rb +39 -0
- data/lib/convenient_service/service/plugins/has_awesome_print_inspect.rb +3 -0
- data/lib/convenient_service/service/plugins/has_inspect/concern.rb +8 -1
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/commands/create_result_class.rb +1 -1
- data/lib/convenient_service/service/plugins/has_j_send_result/commands/is_result.rb +34 -0
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/commands.rb +1 -0
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/concern/class_methods.rb +20 -24
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/concern/instance_methods.rb +4 -12
- data/lib/convenient_service/service/plugins/has_j_send_result/concern.rb +22 -0
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/constants.rb +5 -5
- data/lib/convenient_service/service/plugins/has_j_send_result/container.rb +29 -0
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/concern.rb +1 -1
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/aliases.rb +7 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_own_result/concern.rb +142 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_own_result.rb +3 -0
- data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/has_inspect → has_j_send_result/entities/result/plugins/can_be_stubbed_result}/concern.rb +5 -6
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_be_stubbed_result.rb +3 -0
- data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/has_step → has_j_send_result/entities/result/plugins/can_have_checked_status}/concern.rb +7 -4
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_checked_status/middleware.rb +43 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_checked_status.rb +4 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_fallbacks/concern.rb +44 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_fallbacks.rb +3 -0
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/can_have_parent_result/concern.rb +8 -5
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/can_have_parent_result/constants.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/can_have_parent_result.rb +0 -2
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_step/concern.rb +30 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_step.rb +3 -0
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/can_recalculate_result/concern.rb +1 -1
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_awesome_print_inspect/concern.rb +41 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_awesome_print_inspect.rb +3 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_inspect/concern.rb +38 -0
- 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
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/commands/create_code_class.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/commands/create_data_class.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/commands/create_message_class.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/commands/create_status_class.rb +1 -1
- 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
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/concern/instance_methods.rb +58 -14
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/concern.rb +1 -1
- 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
- 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
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/entities/code/concern/class_methods.rb +14 -2
- 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
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/entities/code/concern.rb +1 -1
- 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
- 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
- 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
- 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
- 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
- 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
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/entities/code.rb +3 -1
- 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
- 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
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/class_methods.rb +14 -2
- 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 +190 -0
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern.rb +1 -1
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/entities/data.rb +3 -1
- 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
- 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
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern/class_methods.rb +14 -2
- 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 +123 -0
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern.rb +1 -1
- 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
- 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
- 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
- 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
- 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
- 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
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/entities/message.rb +3 -1
- 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
- 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
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern/class_methods.rb +14 -2
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern/instance_methods.rb +31 -6
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern.rb +1 -1
- 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
- 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
- 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
- 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
- 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
- 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
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/entities/status.rb +3 -1
- data/lib/convenient_service/service/plugins/{has_result/entities/result/plugins/has_j_send_status_and_attributes/errors.rb → has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/exceptions.rb} +3 -3
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/middleware.rb +5 -3
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/structs/j_send_attributes.rb +2 -2
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes.rb +1 -1
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_stubbed_result_invocations_counter/concern.rb +30 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_stubbed_result_invocations_counter/middleware.rb +38 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_stubbed_result_invocations_counter.rb +4 -0
- 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
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/raises_on_not_checked_result_status/middleware.rb +47 -0
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/raises_on_not_checked_result_status.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins.rb +6 -3
- data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result.rb +1 -1
- data/lib/convenient_service/service/plugins/has_j_send_result/exceptions.rb +21 -0
- data/lib/convenient_service/service/plugins/has_j_send_result.rb +8 -0
- data/lib/convenient_service/service/plugins/{has_result_params_validations → has_j_send_result_params_validations}/using_active_model_validations/concern.rb +1 -1
- data/lib/convenient_service/service/plugins/has_j_send_result_params_validations/using_active_model_validations/middleware.rb +48 -0
- data/lib/convenient_service/service/plugins/{has_result_params_validations → has_j_send_result_params_validations}/using_dry_validation/concern.rb +1 -1
- data/lib/convenient_service/service/plugins/has_j_send_result_params_validations/using_dry_validation/middleware.rb +73 -0
- data/lib/convenient_service/service/plugins/{has_result_short_syntax → has_j_send_result_short_syntax}/concern.rb +1 -1
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/exceptions.rb +87 -0
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/middleware.rb +56 -0
- data/lib/convenient_service/service/plugins/{has_result_short_syntax → has_j_send_result_short_syntax}/error.rb +1 -2
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/exceptions.rb +90 -0
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/middleware.rb +56 -0
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure.rb +4 -0
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/commands/refute_kwargs_contain_j_send_and_extra_keys.rb +67 -0
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/commands.rb +3 -0
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/exceptions.rb +41 -0
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/middleware.rb +27 -0
- data/lib/convenient_service/service/plugins/{has_result_short_syntax → has_j_send_result_short_syntax}/success.rb +1 -1
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax.rb +6 -0
- data/lib/convenient_service/service/plugins/{has_result_status_check_short_syntax → has_j_send_result_status_check_short_syntax}/concern.rb +1 -1
- data/lib/convenient_service/service/plugins/has_j_send_result_status_check_short_syntax.rb +3 -0
- data/lib/convenient_service/service/plugins/has_mermaid_flowchart/concern.rb +24 -0
- data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands/generate_lines.rb +94 -0
- data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands/generate_method_step_lines.rb +115 -0
- data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands/generate_result_lines.rb +105 -0
- data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands/generate_service_lines.rb +88 -0
- data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands/generate_service_step_lines.rb +127 -0
- data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code/commands.rb +7 -0
- data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/code.rb +90 -0
- data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/settings.rb +144 -0
- data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities/template.rb +85 -0
- data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/entities.rb +5 -0
- data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart/templates/flowchart.html.erb +95 -0
- data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities/flowchart.rb +108 -0
- data/lib/convenient_service/service/plugins/has_mermaid_flowchart/entities.rb +3 -0
- data/lib/convenient_service/service/plugins/has_mermaid_flowchart.rb +4 -0
- data/lib/convenient_service/service/plugins/has_result/concern.rb +17 -6
- data/lib/convenient_service/service/plugins/has_result/exceptions.rb +21 -0
- data/lib/convenient_service/service/plugins/has_result.rb +1 -5
- data/lib/convenient_service/service/plugins/raises_on_double_result/{errors.rb → exceptions.rb} +2 -2
- data/lib/convenient_service/service/plugins/raises_on_double_result/middleware.rb +11 -9
- data/lib/convenient_service/service/plugins/raises_on_double_result.rb +1 -1
- data/lib/convenient_service/service/plugins/raises_on_not_result_return_value/exceptions.rb +24 -0
- data/lib/convenient_service/service/plugins/raises_on_not_result_return_value/middleware.rb +25 -0
- data/lib/convenient_service/service/plugins/raises_on_not_result_return_value.rb +4 -0
- data/lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/middleware.rb +49 -7
- data/lib/convenient_service/service/plugins/sets_parent_to_foreign_result/middleware.rb +56 -0
- data/lib/convenient_service/service/plugins/sets_parent_to_foreign_result.rb +3 -0
- data/lib/convenient_service/service/plugins/wraps_result_in_db_transaction/middleware.rb +3 -1
- data/lib/convenient_service/service/plugins.rb +14 -6
- data/lib/convenient_service/support/abstract_method/{errors.rb → exceptions.rb} +2 -2
- data/lib/convenient_service/support/abstract_method.rb +2 -2
- data/lib/convenient_service/support/cache/constants.rb +36 -0
- data/lib/convenient_service/support/cache/entities/caches/array/entities/pair.rb +52 -0
- data/lib/convenient_service/support/cache/entities/caches/array/entities.rb +3 -0
- data/lib/convenient_service/support/cache/entities/caches/array.rb +135 -0
- data/lib/convenient_service/support/cache/entities/caches/base.rb +112 -0
- data/lib/convenient_service/support/cache/entities/caches/hash.rb +113 -0
- data/lib/convenient_service/support/cache/entities/caches/thread_safe_array.rb +89 -0
- data/lib/convenient_service/support/cache/entities/caches.rb +8 -0
- data/lib/convenient_service/support/cache/entities/key.rb +102 -0
- data/lib/convenient_service/support/cache/entities.rb +4 -0
- data/lib/convenient_service/support/cache/exceptions.rb +34 -0
- data/lib/convenient_service/support/cache.rb +16 -143
- data/lib/convenient_service/support/castable/{errors.rb → exceptions.rb} +3 -3
- data/lib/convenient_service/support/castable.rb +2 -2
- data/lib/convenient_service/support/command.rb +42 -3
- data/lib/convenient_service/support/copyable.rb +7 -23
- data/lib/convenient_service/support/counter.rb +7 -8
- data/lib/convenient_service/support/dependency_container/commands/assert_valid_container.rb +2 -2
- data/lib/convenient_service/support/dependency_container/commands/assert_valid_method.rb +8 -8
- data/lib/convenient_service/support/dependency_container/commands/assert_valid_scope.rb +2 -2
- data/lib/convenient_service/support/dependency_container/entities/method.rb +49 -12
- data/lib/convenient_service/support/dependency_container/entities/method_collection.rb +3 -3
- data/lib/convenient_service/support/dependency_container/{errors.rb → exceptions.rb} +5 -5
- data/lib/convenient_service/support/dependency_container/export.rb +4 -4
- data/lib/convenient_service/support/dependency_container/import.rb +7 -4
- data/lib/convenient_service/support/dependency_container.rb +1 -1
- data/lib/convenient_service/support/finite_loop.rb +8 -8
- data/lib/convenient_service/support/gems/logger.rb +37 -0
- data/lib/convenient_service/support/gems/paint.rb +37 -0
- data/lib/convenient_service/support/gems.rb +2 -0
- data/lib/convenient_service/support/safe_method.rb +1 -1
- data/lib/convenient_service/support/thread_safe_counter.rb +9 -0
- data/lib/convenient_service/support.rb +1 -0
- data/lib/convenient_service/utils/array/contain_exactly.rb +1 -5
- data/lib/convenient_service/utils/array/{errors.rb → exceptions.rb} +2 -2
- data/lib/convenient_service/utils/array/limited_push.rb +54 -0
- data/lib/convenient_service/utils/array/merge.rb +3 -3
- data/lib/convenient_service/utils/array.rb +6 -1
- data/lib/convenient_service/utils/class/display_name.rb +49 -0
- data/lib/convenient_service/utils/class.rb +20 -0
- data/lib/convenient_service/utils/hash/assert_valid_keys.rb +50 -0
- data/lib/convenient_service/utils/hash/except.rb +1 -1
- data/lib/convenient_service/utils/hash/triple_equality_compare.rb +51 -0
- data/lib/convenient_service/utils/hash.rb +10 -0
- data/lib/convenient_service/utils/method/defined.rb +50 -6
- data/lib/convenient_service/utils/module/class_method_defined.rb +22 -2
- data/lib/convenient_service/utils/module/get_own_instance_method.rb +3 -0
- data/lib/convenient_service/utils/module/instance_method_defined.rb +22 -2
- data/lib/convenient_service/utils/object/clamp_class.rb +77 -0
- data/lib/convenient_service/utils/object/duck_class.rb +112 -0
- data/lib/convenient_service/utils/object/memoize_including_falsy_values.rb +1 -1
- data/lib/convenient_service/utils/object.rb +19 -10
- data/lib/convenient_service/utils/string/truncate.rb +69 -0
- data/lib/convenient_service/utils/string.rb +5 -0
- data/lib/convenient_service/utils.rb +21 -0
- data/lib/convenient_service/version.rb +1 -1
- data/lib/convenient_service.rb +14 -7
- data/minitest.rb +30 -0
- metadata +682 -153
- data/lib/convenient_service/common/plugins/caches_constructor_params/concern.rb +0 -22
- data/lib/convenient_service/common/plugins/caches_constructor_params/entities/constructor_params.rb +0 -34
- data/lib/convenient_service/common/plugins/caches_constructor_params/entities.rb +0 -3
- data/lib/convenient_service/common/plugins/caches_constructor_params/middleware.rb +0 -17
- data/lib/convenient_service/common/plugins/caches_constructor_params.rb +0 -5
- data/lib/convenient_service/core/class_methods.rb +0 -96
- data/lib/convenient_service/core/entities/classic_middleware.rb +0 -32
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/chain.rb +0 -71
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware.rb +0 -131
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware_creator.rb +0 -62
- data/lib/convenient_service/core/instance_methods.rb +0 -56
- data/lib/convenient_service/error.rb +0 -16
- data/lib/convenient_service/rspec/helpers/custom/ignoring_error.rb +0 -32
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands/find_result_method_step.rb +0 -74
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands/find_result_result_method_step.rb +0 -66
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands/find_result_service_step.rb +0 -48
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands/generate_expected_step_part.rb +0 -42
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands/generate_got_step_part.rb +0 -42
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands/match_result_step.rb +0 -89
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands.rb +0 -10
- data/lib/convenient_service/service/plugins/can_have_result_step/middleware.rb +0 -43
- data/lib/convenient_service/service/plugins/can_have_result_step.rb +0 -3
- data/lib/convenient_service/service/plugins/can_have_steps/entities/service/class_methods.rb +0 -32
- data/lib/convenient_service/service/plugins/can_have_stubbed_result/concern.rb +0 -59
- data/lib/convenient_service/service/plugins/can_have_stubbed_result/middleware.rb +0 -36
- data/lib/convenient_service/service/plugins/can_have_stubbed_result.rb +0 -4
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/aliases.rb +0 -7
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result/initialize/middleware.rb +0 -27
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result/initialize.rb +0 -3
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result/to_kwargs/middleware.rb +0 -25
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result/to_kwargs.rb +0 -3
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/commands/cast_j_send_attributes.rb +0 -37
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/concern/class_methods.rb +0 -69
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/concern/instance_methods.rb +0 -65
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb +0 -94
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern/instance_methods.rb +0 -58
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_result_short_syntax/concern.rb +0 -62
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_result_short_syntax.rb +0 -3
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_step/initialize/middleware.rb +0 -27
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_step/initialize.rb +0 -3
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_step/to_kwargs/middleware.rb +0 -25
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_step/to_kwargs.rb +0 -3
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_step.rb +0 -5
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/marks_result_status_as_checked/middleware.rb +0 -25
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/marks_result_status_as_checked.rb +0 -3
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/raises_on_not_checked_result_status/middleware.rb +0 -33
- data/lib/convenient_service/service/plugins/has_result/errors.rb +0 -34
- data/lib/convenient_service/service/plugins/has_result/middleware.rb +0 -19
- data/lib/convenient_service/service/plugins/has_result_params_validations/using_active_model_validations/middleware.rb +0 -35
- data/lib/convenient_service/service/plugins/has_result_params_validations/using_dry_validation/middleware.rb +0 -49
- data/lib/convenient_service/service/plugins/has_result_short_syntax/error/commands/assert_args_count_lower_than_three.rb +0 -25
- data/lib/convenient_service/service/plugins/has_result_short_syntax/error/commands/assert_either_args_or_kwargs_are_passed.rb +0 -26
- data/lib/convenient_service/service/plugins/has_result_short_syntax/error/commands.rb +0 -4
- data/lib/convenient_service/service/plugins/has_result_short_syntax/error/errors.rb +0 -46
- data/lib/convenient_service/service/plugins/has_result_short_syntax/error/middleware.rb +0 -27
- data/lib/convenient_service/service/plugins/has_result_short_syntax/failure/commands/refute_kwargs_contain_data_and_extra_keys.rb +0 -29
- data/lib/convenient_service/service/plugins/has_result_short_syntax/failure/commands.rb +0 -3
- data/lib/convenient_service/service/plugins/has_result_short_syntax/failure/errors.rb +0 -28
- data/lib/convenient_service/service/plugins/has_result_short_syntax/failure/middleware.rb +0 -19
- data/lib/convenient_service/service/plugins/has_result_short_syntax/failure.rb +0 -5
- data/lib/convenient_service/service/plugins/has_result_short_syntax/success/commands/refute_kwargs_contain_data_and_extra_keys.rb +0 -29
- data/lib/convenient_service/service/plugins/has_result_short_syntax/success/commands.rb +0 -3
- data/lib/convenient_service/service/plugins/has_result_short_syntax/success/errors.rb +0 -28
- data/lib/convenient_service/service/plugins/has_result_short_syntax/success/middleware.rb +0 -19
- data/lib/convenient_service/service/plugins/has_result_short_syntax.rb +0 -6
- data/lib/convenient_service/service/plugins/has_result_status_check_short_syntax.rb +0 -3
- data/lib/convenient_service/services/run_method_in_organizer.rb +0 -28
- data/lib/convenient_service/services/run_own_method_in_organizer.rb +0 -64
- data/lib/convenient_service/support/cache/key.rb +0 -100
- data/lib/convenient_service/utils/object/resolve_class.rb +0 -56
- /data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/can_recalculate_result.rb +0 -0
- /data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_inspect.rb +0 -0
- /data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/commands.rb +0 -0
- /data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/entities.rb +0 -0
- /data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities/result/plugins/has_j_send_status_and_attributes/structs.rb +0 -0
- /data/lib/convenient_service/service/plugins/{has_result → has_j_send_result}/entities.rb +0 -0
- /data/lib/convenient_service/service/plugins/{has_result_params_validations → has_j_send_result_params_validations}/using_active_model_validations.rb +0 -0
- /data/lib/convenient_service/service/plugins/{has_result_params_validations → has_j_send_result_params_validations}/using_dry_validation.rb +0 -0
@@ -1,18 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
##
|
4
|
-
#
|
4
|
+
# @internal
|
5
|
+
# NOTE: Order matters.
|
5
6
|
#
|
7
|
+
require_relative "plugins/has_result"
|
8
|
+
require_relative "plugins/has_j_send_result"
|
9
|
+
|
6
10
|
require_relative "plugins/can_recalculate_result"
|
7
11
|
require_relative "plugins/can_have_method_steps"
|
8
|
-
require_relative "plugins/can_have_result_step"
|
9
12
|
require_relative "plugins/can_have_steps"
|
10
|
-
require_relative "plugins/
|
13
|
+
require_relative "plugins/can_have_stubbed_results"
|
14
|
+
require_relative "plugins/can_have_fallbacks"
|
15
|
+
require_relative "plugins/collects_services_in_exception"
|
16
|
+
require_relative "plugins/counts_stubbed_results_invocations"
|
11
17
|
require_relative "plugins/has_inspect"
|
12
|
-
require_relative "plugins/
|
13
|
-
require_relative "plugins/
|
18
|
+
require_relative "plugins/has_j_send_result_short_syntax"
|
19
|
+
require_relative "plugins/has_j_send_result_status_check_short_syntax"
|
20
|
+
require_relative "plugins/has_mermaid_flowchart"
|
21
|
+
require_relative "plugins/raises_on_not_result_return_value"
|
14
22
|
require_relative "plugins/raises_on_double_result"
|
23
|
+
require_relative "plugins/sets_parent_to_foreign_result"
|
15
24
|
require_relative "plugins/wraps_result_in_db_transaction"
|
16
|
-
require_relative "plugins/has_result_status_check_short_syntax"
|
17
25
|
|
18
26
|
require_relative "plugins/aliases"
|
@@ -3,8 +3,8 @@
|
|
3
3
|
module ConvenientService
|
4
4
|
module Support
|
5
5
|
module AbstractMethod
|
6
|
-
module
|
7
|
-
class AbstractMethodNotOverridden < ::ConvenientService::
|
6
|
+
module Exceptions
|
7
|
+
class AbstractMethodNotOverridden < ::ConvenientService::Exception
|
8
8
|
def initialize(instance:, method:)
|
9
9
|
klass = instance.is_a?(::Class) ? instance : instance.class
|
10
10
|
method_type = Utils::Object.resolve_type(instance)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "abstract_method/
|
3
|
+
require_relative "abstract_method/exceptions"
|
4
4
|
|
5
5
|
module ConvenientService
|
6
6
|
module Support
|
@@ -11,7 +11,7 @@ module ConvenientService
|
|
11
11
|
def abstract_method(*names)
|
12
12
|
names.each do |name|
|
13
13
|
define_method(name) do |*args, **kwargs, &block|
|
14
|
-
raise
|
14
|
+
raise Exceptions::AbstractMethodNotOverridden.new(instance: self, method: name)
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Support
|
5
|
+
class Cache
|
6
|
+
class Constants
|
7
|
+
module Backends
|
8
|
+
##
|
9
|
+
# @return [Symbol]
|
10
|
+
#
|
11
|
+
ARRAY = :array
|
12
|
+
|
13
|
+
##
|
14
|
+
# @return [Symbol]
|
15
|
+
#
|
16
|
+
HASH = :hash
|
17
|
+
|
18
|
+
##
|
19
|
+
# @return [Symbol]
|
20
|
+
#
|
21
|
+
THREAD_SAFE_ARRAY = :thread_safe_array
|
22
|
+
|
23
|
+
##
|
24
|
+
# @return [Array<Symbol>]
|
25
|
+
#
|
26
|
+
ALL = [ARRAY, HASH, THREAD_SAFE_ARRAY]
|
27
|
+
|
28
|
+
##
|
29
|
+
# @return [Symbol]
|
30
|
+
#
|
31
|
+
DEFAULT = HASH
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Support
|
5
|
+
class Cache
|
6
|
+
module Entities
|
7
|
+
module Caches
|
8
|
+
class Array < Caches::Base
|
9
|
+
module Entities
|
10
|
+
class Pair
|
11
|
+
##
|
12
|
+
# @!attribute [r] key
|
13
|
+
# @return [ConvenientService::Support::Cache::Entities::Key]
|
14
|
+
#
|
15
|
+
attr_reader :key
|
16
|
+
|
17
|
+
##
|
18
|
+
# @!attribute [rw] value
|
19
|
+
# @return [Object] Can be any type.
|
20
|
+
#
|
21
|
+
attr_reader :value
|
22
|
+
|
23
|
+
##
|
24
|
+
# @param key [Object] Can be any type.
|
25
|
+
# @param value [Object] Can be any type.
|
26
|
+
# @return [void]
|
27
|
+
#
|
28
|
+
def initialize(key:, value:)
|
29
|
+
@key = key
|
30
|
+
@value = value
|
31
|
+
end
|
32
|
+
|
33
|
+
##
|
34
|
+
# @param other [Object] Can be any type.
|
35
|
+
# @return [void]
|
36
|
+
#
|
37
|
+
def ==(other)
|
38
|
+
return unless other.instance_of?(self.class)
|
39
|
+
|
40
|
+
return false if key != other.key
|
41
|
+
return false if value != other.value
|
42
|
+
|
43
|
+
true
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "array/entities"
|
4
|
+
|
5
|
+
module ConvenientService
|
6
|
+
module Support
|
7
|
+
class Cache
|
8
|
+
module Entities
|
9
|
+
module Caches
|
10
|
+
class Array < Caches::Base
|
11
|
+
##
|
12
|
+
# @return [void]
|
13
|
+
#
|
14
|
+
def initialize(array = [])
|
15
|
+
@array = array
|
16
|
+
end
|
17
|
+
|
18
|
+
##
|
19
|
+
# @return [Array<ConvenientService::Support::Cache::Entities::Caches::Array::Entities::Pair>]
|
20
|
+
#
|
21
|
+
def store
|
22
|
+
array
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# @return [Boolean]
|
27
|
+
#
|
28
|
+
def empty?
|
29
|
+
array.empty?
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# @param key [Object] Can be any type.
|
34
|
+
# @return [Boolean]
|
35
|
+
#
|
36
|
+
def exist?(key)
|
37
|
+
index = index(key)
|
38
|
+
|
39
|
+
index ? true : false
|
40
|
+
end
|
41
|
+
|
42
|
+
##
|
43
|
+
# @param key [Object] Can be any type.
|
44
|
+
# @return [Object] Can be any type.
|
45
|
+
#
|
46
|
+
def read(key)
|
47
|
+
index = index(key)
|
48
|
+
|
49
|
+
array[index].value if index
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# @param key [Object] Can be any type.
|
54
|
+
# @param value [Object] Can be any type.
|
55
|
+
# @return [Object] Can be any type.
|
56
|
+
#
|
57
|
+
def write(key, value)
|
58
|
+
index = index(key) || array.size
|
59
|
+
|
60
|
+
array[index] = pair(key, value)
|
61
|
+
|
62
|
+
value
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# @param key [Object] Can be any type.
|
67
|
+
# @param block [Proc, nil]
|
68
|
+
# @return [Object] Can be any type.
|
69
|
+
#
|
70
|
+
# @internal
|
71
|
+
# https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-fetch
|
72
|
+
#
|
73
|
+
def fetch(key, &block)
|
74
|
+
index = index(key)
|
75
|
+
|
76
|
+
return array[index].value if index
|
77
|
+
|
78
|
+
return unless block
|
79
|
+
|
80
|
+
value = yield
|
81
|
+
|
82
|
+
array << pair(key, value)
|
83
|
+
|
84
|
+
value
|
85
|
+
end
|
86
|
+
|
87
|
+
##
|
88
|
+
# @param key [Object] Can be any type.
|
89
|
+
# @return [Object] Can be any type.
|
90
|
+
#
|
91
|
+
def delete(key)
|
92
|
+
index = index(key)
|
93
|
+
|
94
|
+
array.delete_at(index).value if index
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# @return [ConvenientService::Support::Cache::Entities::Caches::Array]
|
99
|
+
#
|
100
|
+
def clear
|
101
|
+
array.clear
|
102
|
+
|
103
|
+
self
|
104
|
+
end
|
105
|
+
|
106
|
+
private
|
107
|
+
|
108
|
+
##
|
109
|
+
# @!attribute [r] array
|
110
|
+
# @return [Array]
|
111
|
+
#
|
112
|
+
attr_reader :array
|
113
|
+
|
114
|
+
##
|
115
|
+
# @param key [Object] Can be any type.
|
116
|
+
# @return [Integer, nil]
|
117
|
+
#
|
118
|
+
def index(key)
|
119
|
+
array.find_index { |pair| pair.key == key }
|
120
|
+
end
|
121
|
+
|
122
|
+
##
|
123
|
+
# @param key [Object] Can be any type.
|
124
|
+
# @param value [Object] Can be any type.
|
125
|
+
# @return [ConvenientService::Support::Cache::Entities::Caches::Array::Pair]
|
126
|
+
#
|
127
|
+
def pair(key, value)
|
128
|
+
Entities::Pair.new(key: key, value: value)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Support
|
5
|
+
class Cache
|
6
|
+
module Entities
|
7
|
+
module Caches
|
8
|
+
class Base
|
9
|
+
include Support::AbstractMethod
|
10
|
+
|
11
|
+
class << self
|
12
|
+
##
|
13
|
+
# @return [ConvenientService::Support::Cache::Entities::Key]
|
14
|
+
#
|
15
|
+
def keygen(...)
|
16
|
+
Entities::Key.new(...)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# @return [Boolean]
|
22
|
+
#
|
23
|
+
abstract_method :empty?
|
24
|
+
|
25
|
+
##
|
26
|
+
# @return [Boolean]
|
27
|
+
#
|
28
|
+
abstract_method :exist?
|
29
|
+
|
30
|
+
##
|
31
|
+
# @return [Object] Can be any type.
|
32
|
+
#
|
33
|
+
abstract_method :read
|
34
|
+
|
35
|
+
##
|
36
|
+
# @return [Object] Can be any type.
|
37
|
+
#
|
38
|
+
abstract_method :write
|
39
|
+
|
40
|
+
##
|
41
|
+
# @return [Object] Can be any type.
|
42
|
+
#
|
43
|
+
abstract_method :fetch
|
44
|
+
|
45
|
+
##
|
46
|
+
# @return [Object, nil] Can be any type.
|
47
|
+
#
|
48
|
+
abstract_method :delete
|
49
|
+
|
50
|
+
##
|
51
|
+
# @return [ConvenientService::Support::Cache::Enitities::Caches::Base]
|
52
|
+
#
|
53
|
+
abstract_method :clear
|
54
|
+
|
55
|
+
##
|
56
|
+
# @return [void]
|
57
|
+
#
|
58
|
+
def initialize
|
59
|
+
end
|
60
|
+
|
61
|
+
##
|
62
|
+
# @return [ConvenientService::Support::Cache::Entities::Key]
|
63
|
+
#
|
64
|
+
def keygen(...)
|
65
|
+
self.class.keygen(...)
|
66
|
+
end
|
67
|
+
|
68
|
+
##
|
69
|
+
# @return [Object] Can be any type.
|
70
|
+
#
|
71
|
+
# @internal
|
72
|
+
# NOTE: `alias_method` is NOT used in order to have an ability to use `allow(cache).to receive(:read).with(key).and_call_original` for both `cache[key]` and `cache.read(key)` in RSpec.
|
73
|
+
#
|
74
|
+
def [](...)
|
75
|
+
read(...)
|
76
|
+
end
|
77
|
+
|
78
|
+
##
|
79
|
+
# @return [Object] Can be any type.
|
80
|
+
#
|
81
|
+
# @internal
|
82
|
+
# NOTE: `alias_method` is NOT used in order to have an ability to use `allow(cache).to receive(:write).with(key, value).and_call_original` for both `cache[key] = value` and `cache.write(key, value)` in RSpec.
|
83
|
+
#
|
84
|
+
def []=(...)
|
85
|
+
write(...)
|
86
|
+
end
|
87
|
+
|
88
|
+
##
|
89
|
+
# @param key [Object] Can be any type.
|
90
|
+
# @return [ConvenientService::Support::Cache::Entities::Caches::Base]
|
91
|
+
#
|
92
|
+
def scope(key)
|
93
|
+
fetch(key) { self.class.new }
|
94
|
+
end
|
95
|
+
|
96
|
+
##
|
97
|
+
# @param other [Object] Can be any type.
|
98
|
+
# @return [Boolean, nil]
|
99
|
+
#
|
100
|
+
def ==(other)
|
101
|
+
return unless other.instance_of?(self.class)
|
102
|
+
|
103
|
+
return false if store != other.store
|
104
|
+
|
105
|
+
true
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Support
|
5
|
+
class Cache
|
6
|
+
module Entities
|
7
|
+
module Caches
|
8
|
+
class Hash < Caches::Base
|
9
|
+
##
|
10
|
+
# @return [void]
|
11
|
+
#
|
12
|
+
def initialize(hash = {})
|
13
|
+
@hash = hash
|
14
|
+
end
|
15
|
+
|
16
|
+
##
|
17
|
+
# @return [Hash{Object => Object}]
|
18
|
+
#
|
19
|
+
def store
|
20
|
+
hash
|
21
|
+
end
|
22
|
+
|
23
|
+
##
|
24
|
+
# @return [Boolean]
|
25
|
+
#
|
26
|
+
# @internal
|
27
|
+
# https://ruby-doc.org/core-2.7.0/Hash.html#method-i-empty-3F
|
28
|
+
#
|
29
|
+
def empty?
|
30
|
+
hash.empty?
|
31
|
+
end
|
32
|
+
|
33
|
+
##
|
34
|
+
# @param key [Object] Can be any type.
|
35
|
+
# @return [Boolean]
|
36
|
+
#
|
37
|
+
# @internal
|
38
|
+
# https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-exist-3F
|
39
|
+
#
|
40
|
+
def exist?(key)
|
41
|
+
hash.has_key?(key)
|
42
|
+
end
|
43
|
+
|
44
|
+
##
|
45
|
+
# @param key [Object] Can be any type.
|
46
|
+
# @return [Object] Can be any type.
|
47
|
+
#
|
48
|
+
# @internal
|
49
|
+
# https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-read
|
50
|
+
#
|
51
|
+
def read(key)
|
52
|
+
hash[key]
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# @param key [Object] Can be any type.
|
57
|
+
# @param value [Object] Can be any type.
|
58
|
+
# @return [Object] Can be any type.
|
59
|
+
#
|
60
|
+
# @internal
|
61
|
+
# https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-write
|
62
|
+
#
|
63
|
+
def write(key, value)
|
64
|
+
hash[key] = value
|
65
|
+
end
|
66
|
+
|
67
|
+
##
|
68
|
+
# @param key [Object] Can be any type.
|
69
|
+
# @param block [Proc, nil]
|
70
|
+
# @return [Object] Can be any type.
|
71
|
+
#
|
72
|
+
# @internal
|
73
|
+
# https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-fetch
|
74
|
+
#
|
75
|
+
def fetch(key, &block)
|
76
|
+
return hash[key] unless block
|
77
|
+
|
78
|
+
hash.fetch(key) { hash[key] = yield }
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# @param key [Object] Can be any type.
|
83
|
+
# @return [Object] Can be any type.
|
84
|
+
#
|
85
|
+
# @internal
|
86
|
+
# https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-delete
|
87
|
+
#
|
88
|
+
def delete(key)
|
89
|
+
hash.delete(key)
|
90
|
+
end
|
91
|
+
|
92
|
+
##
|
93
|
+
# @return [ConvenientService::Support::Cache::Entities::Caches::Hash]
|
94
|
+
#
|
95
|
+
def clear
|
96
|
+
hash.clear
|
97
|
+
|
98
|
+
self
|
99
|
+
end
|
100
|
+
|
101
|
+
private
|
102
|
+
|
103
|
+
##
|
104
|
+
# @!attribute [r] hash
|
105
|
+
# @return [Hash]
|
106
|
+
#
|
107
|
+
attr_reader :hash
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "array/entities"
|
4
|
+
|
5
|
+
module ConvenientService
|
6
|
+
module Support
|
7
|
+
class Cache
|
8
|
+
module Entities
|
9
|
+
module Caches
|
10
|
+
class ThreadSafeArray < Caches::Array
|
11
|
+
##
|
12
|
+
# @return [void]
|
13
|
+
#
|
14
|
+
def initialize(array = [])
|
15
|
+
super
|
16
|
+
|
17
|
+
@lock = ::Mutex.new
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# @return [Boolean]
|
22
|
+
#
|
23
|
+
def empty?(...)
|
24
|
+
@lock.synchronize { super }
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# @return [Boolean]
|
29
|
+
#
|
30
|
+
def exist?(...)
|
31
|
+
@lock.synchronize { super }
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# @return [Object] Can be any type.
|
36
|
+
#
|
37
|
+
def read(...)
|
38
|
+
@lock.synchronize { super }
|
39
|
+
end
|
40
|
+
|
41
|
+
##
|
42
|
+
# @return [Object] Can be any type.
|
43
|
+
#
|
44
|
+
def write(...)
|
45
|
+
@lock.synchronize { super }
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# @return [Object] Can be any type.
|
50
|
+
#
|
51
|
+
def fetch(...)
|
52
|
+
@lock.synchronize { super }
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# @return [Object] Can be any type.
|
57
|
+
#
|
58
|
+
def delete(...)
|
59
|
+
@lock.synchronize { super }
|
60
|
+
end
|
61
|
+
|
62
|
+
##
|
63
|
+
# @return [ConvenientService::Support::Cache::Entities::Caches::Array]
|
64
|
+
#
|
65
|
+
def clear(...)
|
66
|
+
@lock.synchronize { super }
|
67
|
+
end
|
68
|
+
|
69
|
+
##
|
70
|
+
# @internal
|
71
|
+
# `scope` method from parent delegates to thread-safe `fetch`, that is why child `scope` method does NOT require additional synchronization.
|
72
|
+
#
|
73
|
+
# def scope(...)
|
74
|
+
# # ...
|
75
|
+
# end
|
76
|
+
##
|
77
|
+
|
78
|
+
##
|
79
|
+
# @note NOT thread-safe.
|
80
|
+
#
|
81
|
+
# def ==(other)
|
82
|
+
# # ...
|
83
|
+
# end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|