convenient_service 0.16.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -5
- data/lib/convenient_service/common/plugins/can_have_user_provided_entity/commands/find_or_create_entity.rb +7 -2
- data/lib/convenient_service/common/plugins/can_have_user_provided_entity/exceptions.rb +4 -4
- data/lib/convenient_service/common/plugins/ensures_negated_j_send_result/middleware.rb +22 -0
- data/lib/convenient_service/common/plugins/ensures_negated_j_send_result.rb +3 -0
- data/lib/convenient_service/common/plugins/has_around_callbacks/concern.rb +8 -1
- data/lib/convenient_service/common/plugins/has_around_callbacks/exceptions.rb +2 -2
- data/lib/convenient_service/common/plugins/has_around_callbacks/middleware.rb +30 -9
- data/lib/convenient_service/common/plugins/has_callbacks/concern.rb +19 -9
- data/lib/convenient_service/common/plugins/has_callbacks/entities/callback_collection.rb +49 -1
- data/lib/convenient_service/common/plugins/has_callbacks/middleware.rb +21 -3
- data/lib/convenient_service/common/plugins/has_callbacks.rb +0 -1
- data/lib/convenient_service/common/plugins/has_instance_proxy/commands/create_instance_proxy_class.rb +83 -0
- data/lib/convenient_service/common/plugins/has_instance_proxy/commands.rb +3 -0
- data/lib/convenient_service/common/plugins/has_instance_proxy/concern.rb +22 -0
- data/lib/convenient_service/common/plugins/has_instance_proxy/entities/instance_proxy.rb +76 -0
- data/lib/convenient_service/common/plugins/has_instance_proxy/entities.rb +3 -0
- data/lib/convenient_service/common/plugins/has_instance_proxy/middleware.rb +20 -0
- data/lib/convenient_service/common/plugins/has_instance_proxy.rb +6 -0
- data/lib/convenient_service/common/plugins/has_internals/entities/internals/plugins/has_cache/concern.rb +12 -0
- data/lib/convenient_service/common/plugins.rb +2 -0
- data/lib/convenient_service/core/concern/class_methods.rb +7 -2
- data/lib/convenient_service/core/concern/instance_methods.rb +7 -2
- data/lib/convenient_service/core/entities/config/commands/track_method_missing_commit_trigger.rb +1 -1
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller/commands/define_method_middlewares_caller.rb +2 -2
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middlewares/base/commands/create_observable_middleware.rb +3 -0
- data/lib/convenient_service/core/entities/config/exceptions.rb +6 -4
- data/lib/convenient_service/core/entities/config.rb +4 -1
- data/lib/convenient_service/dependencies/extractions/active_support_backtrace_cleaner/backtrace_cleaner.rb +28 -8
- data/lib/convenient_service/dependencies/extractions/active_support_backtrace_cleaner.rb +3 -3
- data/lib/convenient_service/dependencies/extractions/b.rb +2 -0
- data/lib/convenient_service/dependencies/extractions/ce.rb +16 -0
- data/lib/convenient_service/dependencies/extractions.rb +1 -0
- data/lib/convenient_service/dependencies.rb +17 -4
- data/lib/convenient_service/exception.rb +98 -10
- data/lib/convenient_service/feature/configs/standard.rb +8 -0
- data/lib/convenient_service/feature/plugins/can_have_entries/commands/define_entries.rb +49 -0
- data/lib/convenient_service/feature/plugins/can_have_entries/commands/define_entry.rb +18 -4
- data/lib/convenient_service/feature/plugins/can_have_entries/commands.rb +1 -0
- data/lib/convenient_service/feature/plugins/can_have_entries/concern.rb +13 -4
- data/lib/convenient_service/feature/plugins/can_have_entries/exceptions.rb +14 -4
- data/lib/convenient_service/logger.rb +13 -2
- data/lib/convenient_service/rspec/helpers/classes/stub_service/entities/result_spec.rb +0 -8
- data/lib/convenient_service/rspec/helpers/classes/wrap_method/entities/wrapped_method.rb +5 -5
- data/lib/convenient_service/rspec/helpers/classes/wrap_method/exceptions.rb +2 -2
- data/lib/convenient_service/rspec/matchers/classes/call_chain_next.rb +41 -0
- data/lib/convenient_service/rspec/matchers/classes/results/base/entities/validator/commands/validate_result_step.rb +1 -1
- data/lib/convenient_service/rspec/matchers/classes/results/base/exceptions.rb +2 -2
- data/lib/convenient_service/rspec/primitive_helpers/classes/ignoring_exception/exceptions.rb +2 -2
- data/lib/convenient_service/rspec/primitive_helpers/classes/ignoring_exception.rb +1 -1
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/commands/generate_printable_method.rb +46 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/delegation.rb +89 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/inputs.rb +223 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/outputs.rb +38 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matcher_collection.rb +157 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/apply_stub_to_track_delegations.rb +77 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments/commands/generate_printable_arguments.rb +94 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/arguments.rb +89 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/base.rb +99 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/return_custom_value.rb +91 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/return_delegation_value.rb +129 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/with_any_arguments.rb +31 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/with_concrete_arguments.rb +31 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers/without_arguments.rb +31 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/sub_matchers.rb +11 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities.rb +5 -1
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/exceptions.rb +65 -0
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to.rb +163 -41
- data/lib/convenient_service/service/configs/minimal.rb +85 -33
- data/lib/convenient_service/service/configs/standard/v1.rb +42 -24
- data/lib/convenient_service/service/configs/standard.rb +60 -46
- data/lib/convenient_service/service/plugins/can_have_connected_steps/concern.rb +503 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/and.rb +133 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/base.rb +126 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/empty.rb +104 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/group.rb +118 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/not.rb +118 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/or.rb +145 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions/scalar.rb +133 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/expressions.rb +10 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities/step_collection.rb +217 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/entities.rb +4 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/exceptions.rb +95 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps/middleware.rb +30 -0
- data/lib/convenient_service/service/plugins/can_have_connected_steps.rb +6 -0
- data/lib/convenient_service/service/plugins/can_have_fallbacks/concern.rb +2 -2
- data/lib/convenient_service/service/plugins/can_have_fallbacks/exceptions.rb +4 -4
- data/lib/convenient_service/service/plugins/can_have_fallbacks/middleware.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_sequential_steps/concern.rb +76 -0
- data/lib/convenient_service/service/plugins/{can_have_steps → can_have_sequential_steps}/entities/step_collection.rb +54 -10
- data/lib/convenient_service/service/plugins/can_have_sequential_steps/entities.rb +3 -0
- data/lib/convenient_service/service/plugins/{can_have_steps → can_have_sequential_steps}/middleware.rb +7 -3
- data/lib/convenient_service/service/plugins/can_have_sequential_steps.rb +5 -0
- data/lib/convenient_service/service/plugins/can_have_steps/concern.rb +5 -58
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/define_method_in_container.rb +45 -26
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/concern/instance_methods.rb +1 -1
- 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/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 -4
- 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/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/exceptions.rb +27 -47
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/concern/instance_methods.rb +156 -81
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/exceptions.rb +21 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/{can_be_result_step → can_be_method_step}/can_be_executed/exceptions.rb +3 -3
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/can_be_executed/middleware.rb +64 -4
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/can_be_executed.rb +1 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_method_step/concern.rb +7 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_alternative_steps.rb +3 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/concern.rb +0 -46
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_fallbacks/middleware.rb +26 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_have_parent_result/middleware.rb +13 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/{can_be_result_step → has_result}/concern.rb +8 -4
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/has_result/middleware.rb +33 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/has_result.rb +4 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value/exceptions.rb +2 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/raises_on_not_result_return_value/middleware.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins.rb +2 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities.rb +0 -1
- data/lib/convenient_service/service/plugins/can_have_steps.rb +0 -1
- data/lib/convenient_service/service/plugins/has_inspect/concern.rb +0 -1
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_checked_status/concern.rb +2 -2
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_checked_status.rb +0 -1
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/concern/instance_methods.rb +140 -0
- 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 +1 -1
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern/instance_methods.rb +45 -3
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/can_be_checked/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/can_be_checked/middleware.rb +51 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/can_be_checked.rb +4 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins.rb +1 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/exceptions.rb +17 -2
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_negated_result/concern.rb +72 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_negated_result.rb +3 -0
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/raises_on_not_checked_result_status/exceptions.rb +2 -2
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/raises_on_not_checked_result_status/middleware.rb +2 -2
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins.rb +1 -0
- data/lib/convenient_service/service/plugins/has_j_send_result.rb +39 -1
- data/lib/convenient_service/service/plugins/has_j_send_result_params_validations/using_dry_validation/middleware.rb +4 -0
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/exceptions.rb +6 -6
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/error/middleware.rb +3 -3
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/exceptions.rb +6 -6
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/failure/middleware.rb +3 -3
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/commands/refute_kwargs_contain_j_send_and_extra_keys.rb +1 -1
- data/lib/convenient_service/service/plugins/has_j_send_result_short_syntax/success/exceptions.rb +2 -2
- data/lib/convenient_service/service/plugins/has_j_send_result_status_check_short_syntax/concern.rb +0 -8
- data/lib/convenient_service/service/plugins/has_negated_j_send_result/concern.rb +23 -0
- data/lib/convenient_service/service/plugins/has_negated_j_send_result.rb +3 -0
- data/lib/convenient_service/service/plugins/has_negated_result/concern.rb +33 -0
- data/lib/convenient_service/service/plugins/has_negated_result/exceptions.rb +21 -0
- data/lib/convenient_service/service/plugins/has_negated_result.rb +4 -0
- data/lib/convenient_service/service/plugins/has_result/concern.rb +1 -1
- data/lib/convenient_service/service/plugins/has_result/exceptions.rb +2 -2
- data/lib/convenient_service/service/plugins/raises_on_double_result/exceptions.rb +2 -2
- data/lib/convenient_service/service/plugins/raises_on_double_result/middleware.rb +1 -1
- data/lib/convenient_service/service/plugins/raises_on_not_result_return_value/exceptions.rb +2 -2
- data/lib/convenient_service/service/plugins/raises_on_not_result_return_value/middleware.rb +1 -1
- data/lib/convenient_service/service/plugins/{wraps_result_in_db_transaction → wraps_result_in_d_b_transaction}/middleware.rb +1 -1
- data/lib/convenient_service/service/plugins.rb +7 -2
- data/lib/convenient_service/specification.rb +28 -0
- data/lib/convenient_service/support/abstract_method/exceptions.rb +2 -2
- data/lib/convenient_service/support/abstract_method.rb +1 -1
- data/lib/convenient_service/support/backtrace_cleaner.rb +128 -0
- data/lib/convenient_service/support/cache/entities/caches/base.rb +3 -0
- data/lib/convenient_service/support/cache/exceptions.rb +2 -2
- data/lib/convenient_service/support/cache.rb +1 -1
- data/lib/convenient_service/support/castable/exceptions.rb +4 -4
- data/lib/convenient_service/support/castable.rb +1 -1
- data/lib/convenient_service/support/command.rb +3 -3
- data/lib/convenient_service/support/counter.rb +6 -6
- data/lib/convenient_service/support/dependency_container/commands/assert_valid_container.rb +1 -1
- data/lib/convenient_service/support/dependency_container/commands/assert_valid_method.rb +1 -1
- data/lib/convenient_service/support/dependency_container/commands/assert_valid_scope.rb +1 -1
- data/lib/convenient_service/support/dependency_container/exceptions.rb +8 -8
- data/lib/convenient_service/support/dependency_container/export.rb +1 -1
- data/lib/convenient_service/support/finite_loop.rb +6 -6
- data/lib/convenient_service/support/method_parameters.rb +121 -0
- data/lib/convenient_service/support/never_reach_here.rb +21 -0
- data/lib/convenient_service/support/unique_value.rb +3 -0
- data/lib/convenient_service/support/value.rb +78 -0
- data/lib/convenient_service/support.rb +4 -0
- data/lib/convenient_service/utils/array/exceptions.rb +2 -2
- data/lib/convenient_service/utils/array/find_last.rb +8 -3
- data/lib/convenient_service/utils/array/merge.rb +1 -1
- data/lib/convenient_service/utils/hash/assert_valid_keys.rb +1 -1
- data/lib/convenient_service/utils/object/instance_variable_delete.rb +1 -1
- data/lib/convenient_service/version.rb +1 -1
- data/lib/convenient_service.rb +121 -0
- metadata +129 -347
- data/.dev/.tmuxinator.yml +0 -22
- data/.dockerignore +0 -1
- data/.gem_release.yml +0 -11
- data/.github/contributing.md +0 -15
- data/.github/issue_template.md +0 -35
- data/.github/pull_request_template.md +0 -31
- data/.github/workflows/cd.yml +0 -68
- data/.github/workflows/ci.yml +0 -212
- data/.gitignore +0 -66
- data/.inch.yml +0 -7
- data/.rspec +0 -3
- data/.rubocop.yml +0 -45
- data/.rubocop_rspec.yml +0 -58
- data/.ruby-version +0 -1
- data/.tool-versions +0 -1
- data/.vscode/CacheItsValue.code-snippets +0 -15
- data/.vscode/DelegateTo.code-snippets +0 -15
- data/.vscode/cache_its_value.code-snippets +0 -17
- data/.vscode/comparison.code-snippets +0 -41
- data/.vscode/delegate_to.code-snippets +0 -20
- data/.yardopts +0 -16
- data/Appraisals +0 -146
- data/CHANGELOG.md +0 -474
- data/Gemfile +0 -17
- data/ROADMAP.md +0 -92
- data/Rakefile +0 -54
- data/Taskfile.yml +0 -679
- data/benchmark/commit_config/ips.rb +0 -18
- data/benchmark/commit_config/profile.rb +0 -30
- data/benchmark/empty_service/ips.rb +0 -123
- data/benchmark/has_committed_config/ips.rb +0 -78
- data/benchmark/has_committed_config/profile.rb +0 -30
- data/convenient_service.gemspec +0 -214
- data/coverage/.gitkeep +0 -0
- data/docker/2.7/Dockerfile +0 -73
- data/docker/3.0/Dockerfile +0 -73
- data/docker/3.1/Dockerfile +0 -73
- data/docker/3.2/Dockerfile +0 -73
- data/docker/jruby-9.4/Dockerfile +0 -88
- data/docker/truffleruby-22.3/Dockerfile +0 -91
- data/docs/.gitkeep +0 -0
- data/docs/api/.gitkeep +0 -0
- data/env.rb +0 -23
- data/gemfiles/.gitkeep +0 -0
- data/lib/convenient_service/common/plugins/has_callbacks/container.rb +0 -17
- data/lib/convenient_service/examples/dry/gemfile/dry_service/config.rb +0 -45
- data/lib/convenient_service/examples/dry/gemfile/dry_service.rb +0 -3
- data/lib/convenient_service/examples/dry/gemfile/services/assert_file_exists.rb +0 -29
- data/lib/convenient_service/examples/dry/gemfile/services/assert_file_not_empty.rb +0 -29
- data/lib/convenient_service/examples/dry/gemfile/services/assert_node_available.rb +0 -26
- data/lib/convenient_service/examples/dry/gemfile/services/assert_npm_package_available.rb +0 -39
- data/lib/convenient_service/examples/dry/gemfile/services/assert_valid_ruby_syntax.rb +0 -41
- data/lib/convenient_service/examples/dry/gemfile/services/format.rb +0 -37
- data/lib/convenient_service/examples/dry/gemfile/services/format_body.rb +0 -93
- data/lib/convenient_service/examples/dry/gemfile/services/format_gems_with_envs.rb +0 -96
- data/lib/convenient_service/examples/dry/gemfile/services/format_gems_without_envs.rb +0 -84
- data/lib/convenient_service/examples/dry/gemfile/services/format_header.rb +0 -74
- data/lib/convenient_service/examples/dry/gemfile/services/parse_content.rb +0 -93
- data/lib/convenient_service/examples/dry/gemfile/services/print_shell_command.rb +0 -44
- data/lib/convenient_service/examples/dry/gemfile/services/read_file_content.rb +0 -31
- data/lib/convenient_service/examples/dry/gemfile/services/run_shell_command.rb +0 -45
- data/lib/convenient_service/examples/dry/gemfile/services/strip_comments.rb +0 -109
- data/lib/convenient_service/examples/dry/gemfile/services.rb +0 -18
- data/lib/convenient_service/examples/dry/gemfile.rb +0 -27
- data/lib/convenient_service/examples/dry/v1/gemfile/dry_service/config.rb +0 -47
- data/lib/convenient_service/examples/dry/v1/gemfile/dry_service.rb +0 -3
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_file_exists.rb +0 -31
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_file_not_empty.rb +0 -31
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_node_available.rb +0 -28
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_npm_package_available.rb +0 -41
- data/lib/convenient_service/examples/dry/v1/gemfile/services/assert_valid_ruby_syntax.rb +0 -43
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format.rb +0 -39
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format_body.rb +0 -95
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format_gems_with_envs.rb +0 -98
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format_gems_without_envs.rb +0 -86
- data/lib/convenient_service/examples/dry/v1/gemfile/services/format_header.rb +0 -76
- data/lib/convenient_service/examples/dry/v1/gemfile/services/parse_content.rb +0 -95
- data/lib/convenient_service/examples/dry/v1/gemfile/services/read_file_content.rb +0 -33
- data/lib/convenient_service/examples/dry/v1/gemfile/services/run_shell_command.rb +0 -43
- data/lib/convenient_service/examples/dry/v1/gemfile/services/strip_comments.rb +0 -111
- data/lib/convenient_service/examples/dry/v1/gemfile/services.rb +0 -17
- data/lib/convenient_service/examples/dry/v1/gemfile.rb +0 -29
- data/lib/convenient_service/examples/rails/gemfile/rails_service/config.rb +0 -56
- data/lib/convenient_service/examples/rails/gemfile/rails_service.rb +0 -3
- data/lib/convenient_service/examples/rails/gemfile/services/assert_file_exists.rb +0 -25
- data/lib/convenient_service/examples/rails/gemfile/services/assert_file_not_empty.rb +0 -25
- data/lib/convenient_service/examples/rails/gemfile/services/assert_node_available.rb +0 -26
- data/lib/convenient_service/examples/rails/gemfile/services/assert_npm_package_available.rb +0 -35
- data/lib/convenient_service/examples/rails/gemfile/services/assert_valid_ruby_syntax.rb +0 -35
- data/lib/convenient_service/examples/rails/gemfile/services/format.rb +0 -66
- data/lib/convenient_service/examples/rails/gemfile/services/format_body.rb +0 -79
- data/lib/convenient_service/examples/rails/gemfile/services/format_gems_with_envs.rb +0 -82
- data/lib/convenient_service/examples/rails/gemfile/services/format_gems_without_envs.rb +0 -70
- data/lib/convenient_service/examples/rails/gemfile/services/format_header.rb +0 -68
- data/lib/convenient_service/examples/rails/gemfile/services/merge_sections.rb +0 -25
- data/lib/convenient_service/examples/rails/gemfile/services/parse_content.rb +0 -89
- data/lib/convenient_service/examples/rails/gemfile/services/print_shell_command.rb +0 -40
- data/lib/convenient_service/examples/rails/gemfile/services/read_file_content.rb +0 -27
- data/lib/convenient_service/examples/rails/gemfile/services/replace_file_content.rb +0 -37
- data/lib/convenient_service/examples/rails/gemfile/services/run_shell_command.rb +0 -40
- data/lib/convenient_service/examples/rails/gemfile/services/strip_comments.rb +0 -107
- data/lib/convenient_service/examples/rails/gemfile/services.rb +0 -21
- data/lib/convenient_service/examples/rails/gemfile.rb +0 -27
- data/lib/convenient_service/examples/rails/v1/gemfile/rails_service/config.rb +0 -58
- data/lib/convenient_service/examples/rails/v1/gemfile/rails_service.rb +0 -3
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_file_exists.rb +0 -27
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_file_not_empty.rb +0 -27
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_node_available.rb +0 -28
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_npm_package_available.rb +0 -37
- data/lib/convenient_service/examples/rails/v1/gemfile/services/assert_valid_ruby_syntax.rb +0 -37
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format.rb +0 -68
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format_body.rb +0 -81
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format_gems_with_envs.rb +0 -84
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format_gems_without_envs.rb +0 -72
- data/lib/convenient_service/examples/rails/v1/gemfile/services/format_header.rb +0 -70
- data/lib/convenient_service/examples/rails/v1/gemfile/services/merge_sections.rb +0 -27
- data/lib/convenient_service/examples/rails/v1/gemfile/services/parse_content.rb +0 -91
- data/lib/convenient_service/examples/rails/v1/gemfile/services/read_file_content.rb +0 -29
- data/lib/convenient_service/examples/rails/v1/gemfile/services/replace_file_content.rb +0 -39
- data/lib/convenient_service/examples/rails/v1/gemfile/services/run_shell_command.rb +0 -38
- data/lib/convenient_service/examples/rails/v1/gemfile/services/strip_comments.rb +0 -109
- data/lib/convenient_service/examples/rails/v1/gemfile/services.rb +0 -20
- data/lib/convenient_service/examples/rails/v1/gemfile.rb +0 -29
- data/lib/convenient_service/examples/standard/cowsay/services/build_cloud.rb +0 -42
- data/lib/convenient_service/examples/standard/cowsay/services/build_cow.rb +0 -38
- data/lib/convenient_service/examples/standard/cowsay/services/print.rb +0 -32
- data/lib/convenient_service/examples/standard/cowsay/services.rb +0 -5
- data/lib/convenient_service/examples/standard/cowsay.rb +0 -26
- data/lib/convenient_service/examples/standard/date_time/services/safe_parse.rb +0 -31
- data/lib/convenient_service/examples/standard/date_time/services.rb +0 -3
- data/lib/convenient_service/examples/standard/date_time.rb +0 -25
- data/lib/convenient_service/examples/standard/factorial/services/calculate.rb +0 -55
- data/lib/convenient_service/examples/standard/factorial/services.rb +0 -3
- data/lib/convenient_service/examples/standard/factorial/utils/timeout/with_timeout.rb +0 -50
- data/lib/convenient_service/examples/standard/factorial/utils/timeout.rb +0 -21
- data/lib/convenient_service/examples/standard/factorial/utils.rb +0 -3
- data/lib/convenient_service/examples/standard/factorial.rb +0 -26
- data/lib/convenient_service/examples/standard/gemfile/services/assert_file_exists.rb +0 -30
- data/lib/convenient_service/examples/standard/gemfile/services/assert_file_not_empty.rb +0 -30
- data/lib/convenient_service/examples/standard/gemfile/services/assert_node_available.rb +0 -26
- data/lib/convenient_service/examples/standard/gemfile/services/assert_npm_package_available.rb +0 -48
- data/lib/convenient_service/examples/standard/gemfile/services/assert_valid_ruby_syntax.rb +0 -39
- data/lib/convenient_service/examples/standard/gemfile/services/format.rb +0 -80
- data/lib/convenient_service/examples/standard/gemfile/services/format_body.rb +0 -83
- data/lib/convenient_service/examples/standard/gemfile/services/format_gems_with_envs.rb +0 -86
- data/lib/convenient_service/examples/standard/gemfile/services/format_gems_without_envs.rb +0 -74
- data/lib/convenient_service/examples/standard/gemfile/services/format_header.rb +0 -66
- data/lib/convenient_service/examples/standard/gemfile/services/merge_sections.rb +0 -52
- data/lib/convenient_service/examples/standard/gemfile/services/parse_content.rb +0 -101
- data/lib/convenient_service/examples/standard/gemfile/services/print_shell_command.rb +0 -45
- data/lib/convenient_service/examples/standard/gemfile/services/read_file_content.rb +0 -39
- data/lib/convenient_service/examples/standard/gemfile/services/replace_file_content.rb +0 -48
- data/lib/convenient_service/examples/standard/gemfile/services/run_shell_command.rb +0 -54
- data/lib/convenient_service/examples/standard/gemfile/services/strip_comments.rb +0 -111
- data/lib/convenient_service/examples/standard/gemfile/services.rb +0 -21
- data/lib/convenient_service/examples/standard/gemfile.rb +0 -26
- data/lib/convenient_service/examples/standard/request_params/constants.rb +0 -15
- data/lib/convenient_service/examples/standard/request_params/entities/description.rb +0 -40
- data/lib/convenient_service/examples/standard/request_params/entities/format.rb +0 -40
- data/lib/convenient_service/examples/standard/request_params/entities/id.rb +0 -47
- data/lib/convenient_service/examples/standard/request_params/entities/logger.rb +0 -21
- data/lib/convenient_service/examples/standard/request_params/entities/request.rb +0 -23
- data/lib/convenient_service/examples/standard/request_params/entities/source.rb +0 -40
- data/lib/convenient_service/examples/standard/request_params/entities/tag.rb +0 -40
- data/lib/convenient_service/examples/standard/request_params/entities/title.rb +0 -40
- data/lib/convenient_service/examples/standard/request_params/entities.rb +0 -11
- data/lib/convenient_service/examples/standard/request_params/services/apply_default_param_values.rb +0 -26
- data/lib/convenient_service/examples/standard/request_params/services/cast_params.rb +0 -38
- data/lib/convenient_service/examples/standard/request_params/services/extract_params_from_body.rb +0 -70
- data/lib/convenient_service/examples/standard/request_params/services/extract_params_from_path.rb +0 -62
- data/lib/convenient_service/examples/standard/request_params/services/filter_out_unpermitted_params.rb +0 -26
- data/lib/convenient_service/examples/standard/request_params/services/log_request_params.rb +0 -54
- data/lib/convenient_service/examples/standard/request_params/services/merge_params.rb +0 -26
- data/lib/convenient_service/examples/standard/request_params/services/prepare.rb +0 -65
- data/lib/convenient_service/examples/standard/request_params/services/validate_casted_params.rb +0 -94
- data/lib/convenient_service/examples/standard/request_params/services/validate_uncasted_params.rb +0 -72
- data/lib/convenient_service/examples/standard/request_params/services.rb +0 -13
- data/lib/convenient_service/examples/standard/request_params/utils/array/wrap.rb +0 -46
- data/lib/convenient_service/examples/standard/request_params/utils/array.rb +0 -21
- data/lib/convenient_service/examples/standard/request_params/utils/http/request/parse_body.rb +0 -42
- data/lib/convenient_service/examples/standard/request_params/utils/http/request/parse_path.rb +0 -40
- data/lib/convenient_service/examples/standard/request_params/utils/http/request.rb +0 -28
- data/lib/convenient_service/examples/standard/request_params/utils/http.rb +0 -3
- data/lib/convenient_service/examples/standard/request_params/utils/integer/safe_parse.rb +0 -31
- data/lib/convenient_service/examples/standard/request_params/utils/integer.rb +0 -25
- data/lib/convenient_service/examples/standard/request_params/utils/json/safe_parse.rb +0 -40
- data/lib/convenient_service/examples/standard/request_params/utils/json.rb +0 -21
- data/lib/convenient_service/examples/standard/request_params/utils/object/blank.rb +0 -34
- data/lib/convenient_service/examples/standard/request_params/utils/object/present.rb +0 -31
- data/lib/convenient_service/examples/standard/request_params/utils/object.rb +0 -26
- data/lib/convenient_service/examples/standard/request_params/utils/url/valid.rb +0 -47
- data/lib/convenient_service/examples/standard/request_params/utils/url.rb +0 -21
- data/lib/convenient_service/examples/standard/request_params/utils.rb +0 -8
- data/lib/convenient_service/examples/standard/request_params.rb +0 -50
- data/lib/convenient_service/examples/standard/v1/cowsay/services/build_cloud.rb +0 -44
- data/lib/convenient_service/examples/standard/v1/cowsay/services/build_cow.rb +0 -40
- data/lib/convenient_service/examples/standard/v1/cowsay/services/print.rb +0 -34
- data/lib/convenient_service/examples/standard/v1/cowsay/services.rb +0 -5
- data/lib/convenient_service/examples/standard/v1/cowsay.rb +0 -26
- data/lib/convenient_service/examples/standard/v1/date_time/services/safe_parse.rb +0 -33
- data/lib/convenient_service/examples/standard/v1/date_time/services.rb +0 -3
- data/lib/convenient_service/examples/standard/v1/date_time.rb +0 -25
- data/lib/convenient_service/examples/standard/v1/factorial/services/calculate.rb +0 -51
- data/lib/convenient_service/examples/standard/v1/factorial/services.rb +0 -3
- data/lib/convenient_service/examples/standard/v1/factorial/utils/timeout/with_timeout.rb +0 -52
- data/lib/convenient_service/examples/standard/v1/factorial/utils/timeout.rb +0 -23
- data/lib/convenient_service/examples/standard/v1/factorial/utils.rb +0 -3
- data/lib/convenient_service/examples/standard/v1/factorial.rb +0 -26
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_file_exists.rb +0 -32
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_file_not_empty.rb +0 -32
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_node_available.rb +0 -28
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_npm_package_available.rb +0 -50
- data/lib/convenient_service/examples/standard/v1/gemfile/services/assert_valid_ruby_syntax.rb +0 -41
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format.rb +0 -82
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format_body.rb +0 -85
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format_gems_with_envs.rb +0 -88
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format_gems_without_envs.rb +0 -76
- data/lib/convenient_service/examples/standard/v1/gemfile/services/format_header.rb +0 -68
- data/lib/convenient_service/examples/standard/v1/gemfile/services/merge_sections.rb +0 -54
- data/lib/convenient_service/examples/standard/v1/gemfile/services/parse_content.rb +0 -103
- data/lib/convenient_service/examples/standard/v1/gemfile/services/print_shell_command.rb +0 -47
- data/lib/convenient_service/examples/standard/v1/gemfile/services/read_file_content.rb +0 -41
- data/lib/convenient_service/examples/standard/v1/gemfile/services/replace_file_content.rb +0 -50
- data/lib/convenient_service/examples/standard/v1/gemfile/services/run_shell_command.rb +0 -52
- data/lib/convenient_service/examples/standard/v1/gemfile/services/strip_comments.rb +0 -113
- data/lib/convenient_service/examples/standard/v1/gemfile/services.rb +0 -20
- data/lib/convenient_service/examples/standard/v1/gemfile.rb +0 -26
- data/lib/convenient_service/examples/standard/v1/request_params/constants.rb +0 -17
- data/lib/convenient_service/examples/standard/v1/request_params/entities/description.rb +0 -42
- data/lib/convenient_service/examples/standard/v1/request_params/entities/format.rb +0 -42
- data/lib/convenient_service/examples/standard/v1/request_params/entities/id.rb +0 -49
- data/lib/convenient_service/examples/standard/v1/request_params/entities/logger.rb +0 -23
- data/lib/convenient_service/examples/standard/v1/request_params/entities/request.rb +0 -25
- data/lib/convenient_service/examples/standard/v1/request_params/entities/source.rb +0 -42
- data/lib/convenient_service/examples/standard/v1/request_params/entities/tag.rb +0 -42
- data/lib/convenient_service/examples/standard/v1/request_params/entities/title.rb +0 -42
- data/lib/convenient_service/examples/standard/v1/request_params/entities.rb +0 -11
- data/lib/convenient_service/examples/standard/v1/request_params/services/apply_default_param_values.rb +0 -28
- data/lib/convenient_service/examples/standard/v1/request_params/services/cast_params.rb +0 -40
- data/lib/convenient_service/examples/standard/v1/request_params/services/extract_params_from_body.rb +0 -72
- data/lib/convenient_service/examples/standard/v1/request_params/services/extract_params_from_path.rb +0 -64
- data/lib/convenient_service/examples/standard/v1/request_params/services/filter_out_unpermitted_params.rb +0 -28
- data/lib/convenient_service/examples/standard/v1/request_params/services/log_request_params.rb +0 -56
- data/lib/convenient_service/examples/standard/v1/request_params/services/merge_params.rb +0 -28
- data/lib/convenient_service/examples/standard/v1/request_params/services/prepare.rb +0 -67
- data/lib/convenient_service/examples/standard/v1/request_params/services/validate_casted_params.rb +0 -96
- data/lib/convenient_service/examples/standard/v1/request_params/services/validate_uncasted_params.rb +0 -74
- data/lib/convenient_service/examples/standard/v1/request_params/services.rb +0 -13
- data/lib/convenient_service/examples/standard/v1/request_params/utils/array/wrap.rb +0 -48
- data/lib/convenient_service/examples/standard/v1/request_params/utils/array.rb +0 -23
- data/lib/convenient_service/examples/standard/v1/request_params/utils/http/request/parse_body.rb +0 -44
- data/lib/convenient_service/examples/standard/v1/request_params/utils/http/request/parse_path.rb +0 -42
- data/lib/convenient_service/examples/standard/v1/request_params/utils/http/request.rb +0 -30
- data/lib/convenient_service/examples/standard/v1/request_params/utils/http.rb +0 -3
- data/lib/convenient_service/examples/standard/v1/request_params/utils/integer/safe_parse.rb +0 -33
- data/lib/convenient_service/examples/standard/v1/request_params/utils/integer.rb +0 -27
- data/lib/convenient_service/examples/standard/v1/request_params/utils/json/safe_parse.rb +0 -42
- data/lib/convenient_service/examples/standard/v1/request_params/utils/json.rb +0 -23
- data/lib/convenient_service/examples/standard/v1/request_params/utils/object/blank.rb +0 -36
- data/lib/convenient_service/examples/standard/v1/request_params/utils/object/present.rb +0 -33
- data/lib/convenient_service/examples/standard/v1/request_params/utils/object.rb +0 -28
- data/lib/convenient_service/examples/standard/v1/request_params/utils/url/valid.rb +0 -49
- data/lib/convenient_service/examples/standard/v1/request_params/utils/url.rb +0 -23
- data/lib/convenient_service/examples/standard/v1/request_params/utils.rb +0 -8
- data/lib/convenient_service/examples/standard/v1/request_params.rb +0 -50
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/commands/generate_printable_method.rb +0 -50
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments/commands/apply_stub_to_track_delegations.rb +0 -78
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments/commands/generate_printable_arguments.rb +0 -100
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/arguments.rb +0 -95
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/base.rb +0 -87
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/return_its_value.rb +0 -132
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/with_any_arguments.rb +0 -37
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/with_concrete_arguments.rb +0 -37
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/sub_matchers/without_arguments.rb +0 -37
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/values/base.rb +0 -41
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/values/with_calling_original.rb +0 -30
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings/values/without_calling_original.rb +0 -30
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings.rb +0 -12
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings_collection/exceptions.rb +0 -57
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/chainings_collection.rb +0 -171
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities/delegation.rb +0 -79
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher/entities.rb +0 -5
- data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/matcher.rb +0 -276
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/reassignment/commands/define_method_in_container.rb +0 -74
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/callers/reassignment/commands.rb +0 -3
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step/can_be_executed/middleware.rb +0 -72
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step/can_be_executed.rb +0 -4
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/can_be_result_step.rb +0 -5
- data/lib/convenient_service/service/plugins/has_j_send_result/entities/result/plugins/can_have_checked_status/middleware.rb +0 -43
- data/lib/convenient_service/service/plugins/has_j_send_result/exceptions.rb +0 -21
- data/logo.png +0 -0
- data/minitest.rb +0 -30
- data/yard/yard-convenient_service_concern.rb +0 -45
- /data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/{entities/matcher/commands.rb → commands.rb} +0 -0
- /data/lib/convenient_service/rspec/primitive_matchers/classes/delegate_to/entities/{matcher/entities/chainings/sub_matchers → sub_matchers}/arguments/commands.rb +0 -0
@@ -9,11 +9,13 @@ require_relative "plugins/caches_constructor_arguments"
|
|
9
9
|
require_relative "plugins/caches_return_value"
|
10
10
|
require_relative "plugins/can_be_copied"
|
11
11
|
require_relative "plugins/can_have_user_provided_entity"
|
12
|
+
require_relative "plugins/ensures_negated_j_send_result"
|
12
13
|
require_relative "plugins/has_callbacks"
|
13
14
|
require_relative "plugins/has_around_callbacks"
|
14
15
|
require_relative "plugins/has_constructor"
|
15
16
|
require_relative "plugins/has_constructor_without_initialize"
|
16
17
|
require_relative "plugins/has_internals"
|
18
|
+
require_relative "plugins/has_instance_proxy"
|
17
19
|
require_relative "plugins/has_j_send_result_duck_short_syntax"
|
18
20
|
|
19
21
|
require_relative "plugins/aliases"
|
@@ -70,6 +70,7 @@ module ConvenientService
|
|
70
70
|
|
71
71
|
##
|
72
72
|
# @see https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding
|
73
|
+
# @see https://blog.marc-andre.ca/2010/11/15/methodmissing-politely
|
73
74
|
# @see https://stackoverflow.com/a/3304683/12201472
|
74
75
|
#
|
75
76
|
# @param method_name [Symbol, String]
|
@@ -112,12 +113,16 @@ module ConvenientService
|
|
112
113
|
#
|
113
114
|
# TODO: Include `method` into trigger metadata.
|
114
115
|
#
|
116
|
+
# IMPORTANT: Ruby 2.7 and Ruby 3.0+ invoke this `method_missing` differently, check the following files/links:
|
117
|
+
# - `lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller/commands/define_method_middlewares_caller.rb`
|
118
|
+
# - https://gist.github.com/marian13/9c25041f835564e945d978839097d419
|
119
|
+
#
|
115
120
|
def method_missing(method, *args, **kwargs, &block)
|
116
121
|
commit_config!(trigger: Constants::Triggers::CLASS_METHOD_MISSING)
|
117
122
|
|
118
|
-
return super unless Utils::Module.class_method_defined?(self, method, public: true, protected: false, private: false)
|
123
|
+
return ::ConvenientService.reraise { super } unless Utils::Module.class_method_defined?(self, method, public: true, protected: false, private: false)
|
119
124
|
|
120
|
-
return super if middlewares(method, scope: :class).defined_without_super_method?
|
125
|
+
return ::ConvenientService.reraise { super } if middlewares(method, scope: :class).defined_without_super_method?
|
121
126
|
|
122
127
|
ConvenientService.logger.debug { "[Core] Committed config for `#{self}` | Triggered by `method_missing` | Method: `.#{method}`" }
|
123
128
|
|
@@ -17,6 +17,7 @@ module ConvenientService
|
|
17
17
|
|
18
18
|
##
|
19
19
|
# @see https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding
|
20
|
+
# @see https://blog.marc-andre.ca/2010/11/15/methodmissing-politely
|
20
21
|
# @see https://stackoverflow.com/a/3304683/12201472
|
21
22
|
#
|
22
23
|
# @param method_name [Symbol, String]
|
@@ -59,12 +60,16 @@ module ConvenientService
|
|
59
60
|
#
|
60
61
|
# TODO: Include `method` into trigger metadata.
|
61
62
|
#
|
63
|
+
# IMPORTANT: Ruby 2.7 and Ruby 3.0+ invoke this `method_missing` differently, check the following files/links:
|
64
|
+
# - `lib/convenient_service/core/entities/config/entities/method_middlewares/entities/caller/commands/define_method_middlewares_caller.rb`
|
65
|
+
# - https://gist.github.com/marian13/9c25041f835564e945d978839097d419
|
66
|
+
#
|
62
67
|
def method_missing(method, *args, **kwargs, &block)
|
63
68
|
self.class.commit_config!(trigger: Constants::Triggers::INSTANCE_METHOD_MISSING)
|
64
69
|
|
65
|
-
return super unless Utils::Module.instance_method_defined?(self.class, method, public: true, protected: false, private: false)
|
70
|
+
return ::ConvenientService.reraise { super } unless Utils::Module.instance_method_defined?(self.class, method, public: true, protected: false, private: false)
|
66
71
|
|
67
|
-
return super if self.class.middlewares(method, scope: :instance).defined_without_super_method?
|
72
|
+
return ::ConvenientService.reraise { super } if self.class.middlewares(method, scope: :instance).defined_without_super_method?
|
68
73
|
|
69
74
|
ConvenientService.logger.debug { "[Core] Committed config for `#{self.class}` | Triggered by `method_missing` | Method: `##{method}`" }
|
70
75
|
|
data/lib/convenient_service/core/entities/config/commands/track_method_missing_commit_trigger.rb
CHANGED
@@ -35,7 +35,7 @@ module ConvenientService
|
|
35
35
|
return unless method_missing_trigger_valid?
|
36
36
|
return if method_missing_commits_counter_incremented?
|
37
37
|
|
38
|
-
raise Exceptions::TooManyCommitsFromMethodMissing.new(config: config)
|
38
|
+
::ConvenientService.raise Exceptions::TooManyCommitsFromMethodMissing.new(config: config)
|
39
39
|
end
|
40
40
|
|
41
41
|
##
|
@@ -90,9 +90,9 @@ module ConvenientService
|
|
90
90
|
# prefix = "#{prefix}"
|
91
91
|
#
|
92
92
|
# NOTE: Check the following link in order to get an idea why two versions of `define_method_middlewares_caller` exist.
|
93
|
-
# https://gist.github.com/marian13/9c25041f835564e945d978839097d419
|
93
|
+
# - https://gist.github.com/marian13/9c25041f835564e945d978839097d419
|
94
94
|
#
|
95
|
-
if
|
95
|
+
if Dependencies.ruby.version >= 3.0
|
96
96
|
def define_method_middlewares_caller
|
97
97
|
<<~RUBY.tap { |code| methods_middlewares_callers.module_eval(code, __FILE__, __LINE__ + 1) }
|
98
98
|
def #{method}(*args, **kwargs, &block)
|
@@ -39,6 +39,9 @@ module ConvenientService
|
|
39
39
|
# @param other [Object] Can be any type.
|
40
40
|
# @return [Boolean, nil]
|
41
41
|
#
|
42
|
+
# @internal
|
43
|
+
# TODO: Try `self.middleware == other.middleware if self < ::ConvenientService::Core::Entities::Config::Entities::MethodMiddlewares::Entities::Middlewares::Base`.
|
44
|
+
#
|
42
45
|
define_singleton_method(:==) { |other| self.middleware == other.middleware if other.respond_to?(:middleware) }
|
43
46
|
|
44
47
|
##
|
@@ -10,14 +10,14 @@ module ConvenientService
|
|
10
10
|
# @param config [ConvenientService::Core::Entities::Config]
|
11
11
|
# @return [void]
|
12
12
|
#
|
13
|
-
def
|
13
|
+
def initialize_with_kwargs(config:)
|
14
14
|
message = <<~TEXT
|
15
15
|
Config for `#{config.klass}` is already committed. Only uncommitted configs can be modified.
|
16
16
|
|
17
17
|
Did you accidentally call `concerns(&configuration_block)` or `middlewares(method, scope: scope, &configuration_block)` after using any plugin, after calling `commit_config!`?
|
18
18
|
TEXT
|
19
19
|
|
20
|
-
|
20
|
+
initialize(message)
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -30,7 +30,9 @@ module ConvenientService
|
|
30
30
|
# TODO: Create a troubleshooting page with possible reasons (preliminary RSpec mocks etc).
|
31
31
|
# Append a link to it to the error message.
|
32
32
|
#
|
33
|
-
|
33
|
+
# TODO: Add a note of the most common scenario when this issue appears - when the RSpec stub is used before auto config commitment. For example, with `delegate_to`.
|
34
|
+
#
|
35
|
+
def initialize_with_kwargs(config:)
|
34
36
|
message = <<~TEXT
|
35
37
|
`#{config.klass}` config is committed too many times from `method_missing`.
|
36
38
|
|
@@ -54,7 +56,7 @@ module ConvenientService
|
|
54
56
|
end
|
55
57
|
TEXT
|
56
58
|
|
57
|
-
|
59
|
+
initialize(message)
|
58
60
|
end
|
59
61
|
end
|
60
62
|
end
|
@@ -142,6 +142,9 @@ module ConvenientService
|
|
142
142
|
# @internal
|
143
143
|
# IMPORTANT: `commit!` MUST be thread safe.
|
144
144
|
#
|
145
|
+
# NOTE: Inspired by `Response#commit!` and others.
|
146
|
+
# - https://github.com/rails/rails/blob/36c1591bcb5e0ee3084759c7f42a706fe5bb7ca7/actionpack/lib/action_controller/metal/live.rb#L307
|
147
|
+
#
|
145
148
|
def commit!(trigger: Constants::Triggers::USER)
|
146
149
|
(committed? ? false : concerns.include!)
|
147
150
|
.tap { Commands::TrackMethodMissingCommitTrigger.call(config: self, trigger: trigger) }
|
@@ -162,7 +165,7 @@ module ConvenientService
|
|
162
165
|
def assert_not_committed!
|
163
166
|
return unless committed?
|
164
167
|
|
165
|
-
raise Exceptions::ConfigIsCommitted.new(config: self)
|
168
|
+
::ConvenientService.raise Exceptions::ConfigIsCommitted.new(config: self)
|
166
169
|
end
|
167
170
|
end
|
168
171
|
end
|
@@ -7,15 +7,17 @@ module ConvenientService
|
|
7
7
|
# @internal
|
8
8
|
# NOTE:
|
9
9
|
# Copied from `rails/rails` without any logic modification.
|
10
|
-
# Version: v7.
|
10
|
+
# Version: v7.1.2.
|
11
11
|
# Wrapped in a namespace `ConvenientService::Dependencies::Extractions::ActiveSupportBacktraceCleaner`.
|
12
12
|
#
|
13
|
-
# - https://api.rubyonrails.org/v7.
|
14
|
-
# - https://github.com/rails/rails/blob/v7.
|
13
|
+
# - https://api.rubyonrails.org/v7.1.2/classes/ActiveSupport/BacktraceCleaner.html
|
14
|
+
# - https://github.com/rails/rails/blob/v7.1.2/activesupport/lib/active_support/backtrace_cleaner.rb
|
15
15
|
# - https://github.com/marian13/rails/blob/main/activesupport/lib/active_support/backtrace_cleaner.rb
|
16
16
|
# - https://github.com/rails/rails
|
17
17
|
#
|
18
18
|
module ActiveSupportBacktraceCleaner
|
19
|
+
# = Backtrace Cleaner
|
20
|
+
#
|
19
21
|
# Backtraces often include many lines that are not relevant for the context
|
20
22
|
# under review. This makes it hard to find the signal amongst the backtrace
|
21
23
|
# noise, and adds debugging time. With a BacktraceCleaner, filters and
|
@@ -34,7 +36,7 @@ module ConvenientService
|
|
34
36
|
# bc.add_silencer { |line| /puma|rubygems/.match?(line) } # skip any lines from puma or rubygems
|
35
37
|
# bc.clean(exception.backtrace) # perform the cleanup
|
36
38
|
#
|
37
|
-
# To reconfigure an existing BacktraceCleaner (like the default one in Rails)
|
39
|
+
# To reconfigure an existing BacktraceCleaner (like the default one in \Rails)
|
38
40
|
# and show as much data as possible, you can always call
|
39
41
|
# BacktraceCleaner#remove_silencers!, which will restore the
|
40
42
|
# backtrace to a pristine state. If you need to reconfigure an existing
|
@@ -67,11 +69,29 @@ module ConvenientService
|
|
67
69
|
end
|
68
70
|
alias :filter :clean
|
69
71
|
|
72
|
+
# Returns the frame with all filters applied.
|
73
|
+
# returns +nil+ if the frame was silenced.
|
74
|
+
def clean_frame(frame, kind = :silent)
|
75
|
+
frame = frame.to_s
|
76
|
+
@filters.each do |f|
|
77
|
+
frame = f.call(frame.to_s)
|
78
|
+
end
|
79
|
+
|
80
|
+
case kind
|
81
|
+
when :silent
|
82
|
+
frame unless @silencers.any? { |s| s.call(frame) }
|
83
|
+
when :noise
|
84
|
+
frame if @silencers.any? { |s| s.call(frame) }
|
85
|
+
else
|
86
|
+
frame
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
70
90
|
# Adds a filter from the block provided. Each line in the backtrace will be
|
71
91
|
# mapped against this filter.
|
72
92
|
#
|
73
93
|
# # Will turn "/my/rails/root/app/models/person.rb" into "/app/models/person.rb"
|
74
|
-
# backtrace_cleaner.add_filter { |line| line.gsub(Rails.root, '') }
|
94
|
+
# backtrace_cleaner.add_filter { |line| line.gsub(Rails.root.to_s, '') }
|
75
95
|
def add_filter(&block)
|
76
96
|
@filters << block
|
77
97
|
end
|
@@ -121,7 +141,7 @@ module ConvenientService
|
|
121
141
|
|
122
142
|
def filter_backtrace(backtrace)
|
123
143
|
@filters.each do |f|
|
124
|
-
backtrace = backtrace.map { |line| f.call(line) }
|
144
|
+
backtrace = backtrace.map { |line| f.call(line.to_s) }
|
125
145
|
end
|
126
146
|
|
127
147
|
backtrace
|
@@ -129,7 +149,7 @@ module ConvenientService
|
|
129
149
|
|
130
150
|
def silence(backtrace)
|
131
151
|
@silencers.each do |s|
|
132
|
-
backtrace = backtrace.reject { |line| s.call(line) }
|
152
|
+
backtrace = backtrace.reject { |line| s.call(line.to_s) }
|
133
153
|
end
|
134
154
|
|
135
155
|
backtrace
|
@@ -138,7 +158,7 @@ module ConvenientService
|
|
138
158
|
def noise(backtrace)
|
139
159
|
backtrace.select do |line|
|
140
160
|
@silencers.any? do |s|
|
141
|
-
s.call(line)
|
161
|
+
s.call(line.to_s)
|
142
162
|
end
|
143
163
|
end
|
144
164
|
end
|
@@ -4,11 +4,11 @@
|
|
4
4
|
# @internal
|
5
5
|
# NOTE:
|
6
6
|
# Copied from `rails/rails` without any logic modification.
|
7
|
-
# Version: v7.
|
7
|
+
# Version: v7.1.2.
|
8
8
|
# Wrapped in a namespace `ConvenientService::Dependencies::Extractions::ActiveSupportBacktraceCleaner`.
|
9
9
|
#
|
10
|
-
# - https://api.rubyonrails.org/v7.
|
11
|
-
# - https://github.com/rails/rails/blob/v7.
|
10
|
+
# - https://api.rubyonrails.org/v7.1.2/classes/ActiveSupport/BacktraceCleaner.html
|
11
|
+
# - https://github.com/rails/rails/blob/v7.1.2/activesupport/lib/active_support/backtrace_cleaner.rb
|
12
12
|
# - https://github.com/marian13/rails/blob/main/activesupport/lib/active_support/backtrace_cleaner.rb
|
13
13
|
# - https://github.com/rails/rails
|
14
14
|
#
|
@@ -135,7 +135,7 @@ module ConvenientService
|
|
135
135
|
# @return [Boolean]
|
136
136
|
# @note Expected to be called from app entry points like `initializers` in Rails.
|
137
137
|
#
|
138
|
-
# @see https://
|
138
|
+
# @see https://userdocs.convenientservice.org/troubleshooting/i18n_translate_wrong_number_of_arguments
|
139
139
|
#
|
140
140
|
def require_has_j_send_result_params_validations_using_active_model_validations
|
141
141
|
##
|
@@ -175,13 +175,20 @@ module ConvenientService
|
|
175
175
|
end
|
176
176
|
|
177
177
|
##
|
178
|
-
# @api
|
178
|
+
# @api private
|
179
179
|
#
|
180
180
|
# @return [Boolean]
|
181
181
|
# @note Expected to be called from app entry points like `initializers` in Rails.
|
182
182
|
#
|
183
|
-
def
|
184
|
-
|
183
|
+
def require_wraps_result_in_db_transaction
|
184
|
+
##
|
185
|
+
# - https://edgeguides.rubyonrails.org/active_record_basics.html
|
186
|
+
# - https://api.rubyonrails.org/classes/ActiveRecord.html
|
187
|
+
# - https://github.com/rails/rails/tree/main/activerecord
|
188
|
+
#
|
189
|
+
require "active_record"
|
190
|
+
|
191
|
+
require_relative "service/plugins/wraps_result_in_db_transaction"
|
185
192
|
end
|
186
193
|
|
187
194
|
##
|
@@ -244,6 +251,11 @@ module ConvenientService
|
|
244
251
|
require_relative "dependencies/extractions/byebug_syntax_highlighting" unless ruby.jruby?
|
245
252
|
|
246
253
|
require_relative "dependencies/extractions/b" unless ruby.jruby?
|
254
|
+
|
255
|
+
##
|
256
|
+
#
|
257
|
+
#
|
258
|
+
require_relative "dependencies/extractions/ce"
|
247
259
|
end
|
248
260
|
|
249
261
|
##
|
@@ -331,6 +343,7 @@ module ConvenientService
|
|
331
343
|
require_relative ::File.join("examples", "standard", version, "factorial")
|
332
344
|
require_relative ::File.join("examples", "standard", version, "gemfile")
|
333
345
|
require_relative ::File.join("examples", "standard", version, "request_params")
|
346
|
+
require_relative ::File.join("examples", "standard", version, "comprehensive_suite") if version.empty?
|
334
347
|
end
|
335
348
|
|
336
349
|
##
|
@@ -1,16 +1,104 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
##
|
4
|
-
# Base class for all `ConvenientService` exceptions.
|
5
|
-
# Can be used as a catch-all solution, for example:
|
6
|
-
#
|
7
|
-
# begin
|
8
|
-
# any_service.result
|
9
|
-
# rescue ConvenientService::Exception => exception
|
10
|
-
# puts exception.message
|
11
|
-
# end
|
12
|
-
#
|
13
3
|
module ConvenientService
|
4
|
+
##
|
5
|
+
# Base class for all `ConvenientService` exceptions.
|
6
|
+
#
|
7
|
+
# @example Can be used as a catch-all solution.
|
8
|
+
#
|
9
|
+
# begin
|
10
|
+
# any_service.result
|
11
|
+
# rescue ConvenientService::Exception => exception
|
12
|
+
# puts exception.message
|
13
|
+
# end
|
14
|
+
#
|
14
15
|
class Exception < ::StandardError
|
16
|
+
class << self
|
17
|
+
##
|
18
|
+
# Creates `ConvenientService` exception instance.
|
19
|
+
# In contract to `StandardError.new`, may accept `kwargs`.
|
20
|
+
# In such a case the descendant must implement `initialize_with_kwargs` to specify the logic of how to generate a `message`.
|
21
|
+
# Without arguments behavior is also changed, it calls `initialize_without_arguments` instead of immediately setting `nil` as `message`.
|
22
|
+
#
|
23
|
+
# @note `initialize_with_kwargs` or `initialize_without_arguments` must call `initialize(message)`, otherwise exception instance won't be properly set up.
|
24
|
+
#
|
25
|
+
# @overload new
|
26
|
+
# Calls `initialize_without_arguments` under the hood to generate the exception message.
|
27
|
+
#
|
28
|
+
# @api private
|
29
|
+
#
|
30
|
+
# @return [ConvenientService::Exception]
|
31
|
+
#
|
32
|
+
# @example Usage.
|
33
|
+
# module Exceptions
|
34
|
+
# class Foo < ::ConvenientService::Exception
|
35
|
+
# def initialize_without_arguments
|
36
|
+
# # message = ...
|
37
|
+
# initialize(message)
|
38
|
+
# end
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# ::ConvenientService.raise Foo.new
|
43
|
+
#
|
44
|
+
# @overload new(message)
|
45
|
+
# Calls `initialize(message)` under the hood to set the exception message.
|
46
|
+
#
|
47
|
+
# @api private
|
48
|
+
#
|
49
|
+
# @param message [String]
|
50
|
+
#
|
51
|
+
# @return [ConvenientService::Exception]
|
52
|
+
#
|
53
|
+
# @example Usage.
|
54
|
+
# module Exceptions
|
55
|
+
# class Foo < ::ConvenientService::Exception
|
56
|
+
# end
|
57
|
+
# end
|
58
|
+
#
|
59
|
+
# ::ConvenientService.raise Foo.new("some message")
|
60
|
+
#
|
61
|
+
# @overload new(**kwargs)
|
62
|
+
# Calls `initialize_with_kwargs(**kwargs)` under the hood to generate the exception message.
|
63
|
+
#
|
64
|
+
# @api private
|
65
|
+
#
|
66
|
+
# @param kwargs [Hash{Symbol => Object}]
|
67
|
+
# @return [ConvenientService::Exception]
|
68
|
+
#
|
69
|
+
# @example Usage.
|
70
|
+
# module Exceptions
|
71
|
+
# class Foo < ::ConvenientService::Exception
|
72
|
+
# def initialize_with_kwargs(**kwargs)
|
73
|
+
# # message = ...
|
74
|
+
# initialize(message)
|
75
|
+
# end
|
76
|
+
# end
|
77
|
+
# end
|
78
|
+
#
|
79
|
+
# ::ConvenientService.raise Foo.new(foo: :bar, baz: :qux)
|
80
|
+
#
|
81
|
+
def new(message = nil, **kwargs)
|
82
|
+
if message
|
83
|
+
super(message)
|
84
|
+
elsif kwargs.any?
|
85
|
+
allocate.tap { |exception| exception.initialize_with_kwargs(**kwargs) }
|
86
|
+
else
|
87
|
+
allocate.tap(&:initialize_without_arguments)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
##
|
93
|
+
# @internal
|
94
|
+
# NOTE: Two exceptions are equal when their classes, messages, and backtraces are equal.
|
95
|
+
# - https://blog.arkency.com/2015/01/ruby-exceptions-equality
|
96
|
+
#
|
97
|
+
# TODO: Compare skipping backtraces? Why?
|
98
|
+
#
|
99
|
+
# def ==(other)
|
100
|
+
# # ...
|
101
|
+
# end
|
102
|
+
##
|
15
103
|
end
|
16
104
|
end
|
@@ -14,6 +14,14 @@ module ConvenientService
|
|
14
14
|
|
15
15
|
concerns do
|
16
16
|
use ConvenientService::Plugins::Feature::CanHaveEntries::Concern
|
17
|
+
|
18
|
+
use ConvenientService::Plugins::Common::HasInstanceProxy::Concern
|
19
|
+
end
|
20
|
+
|
21
|
+
middlewares :new, scope: :class do
|
22
|
+
use ConvenientService::Plugins::Common::NormalizesEnv::Middleware
|
23
|
+
|
24
|
+
use ConvenientService::Plugins::Common::HasInstanceProxy::Middleware
|
17
25
|
end
|
18
26
|
end
|
19
27
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Feature
|
5
|
+
module Plugins
|
6
|
+
module CanHaveEntries
|
7
|
+
module Commands
|
8
|
+
class DefineEntries < Support::Command
|
9
|
+
##
|
10
|
+
# @!attribute [r] feature_class
|
11
|
+
# @return [Class]
|
12
|
+
#
|
13
|
+
attr_reader :feature_class
|
14
|
+
|
15
|
+
##
|
16
|
+
# @!attribute [r] names
|
17
|
+
# @return [Array<String, Symbol>]
|
18
|
+
#
|
19
|
+
attr_reader :names
|
20
|
+
|
21
|
+
##
|
22
|
+
# @!attribute [r] body
|
23
|
+
# @return [Proc, nil]
|
24
|
+
#
|
25
|
+
attr_reader :body
|
26
|
+
|
27
|
+
##
|
28
|
+
# @param feature_class [Class]
|
29
|
+
# @param names [Array<String, Symbol>]
|
30
|
+
# @param body [Proc, nil]
|
31
|
+
#
|
32
|
+
def initialize(feature_class:, names:, body:)
|
33
|
+
@feature_class = feature_class
|
34
|
+
@names = names
|
35
|
+
@body = body
|
36
|
+
end
|
37
|
+
|
38
|
+
##
|
39
|
+
# @return [Array<String, Symbol>]
|
40
|
+
#
|
41
|
+
def call
|
42
|
+
names.map { |name| Commands::DefineEntry.call(feature_class: feature_class, name: name, body: body) }
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -20,14 +20,14 @@ module ConvenientService
|
|
20
20
|
|
21
21
|
##
|
22
22
|
# @!attribute [r] body
|
23
|
-
# @return [Proc]
|
23
|
+
# @return [Proc, nil]
|
24
24
|
#
|
25
25
|
attr_reader :body
|
26
26
|
|
27
27
|
##
|
28
28
|
# @param feature_class [Class]
|
29
29
|
# @param name [String, Symbol]
|
30
|
-
# @param body [Proc]
|
30
|
+
# @param body [Proc, nil]
|
31
31
|
#
|
32
32
|
def initialize(feature_class:, name:, body:)
|
33
33
|
@feature_class = feature_class
|
@@ -44,13 +44,27 @@ module ConvenientService
|
|
44
44
|
# That is why `feature_class.class_exec` wrapper is required.
|
45
45
|
#
|
46
46
|
feature_class.class_exec(name) do |name|
|
47
|
-
define_singleton_method(name) { |*args, **kwargs, &block| new.
|
47
|
+
define_singleton_method(name) { |*args, **kwargs, &block| new.entry(name, *args, **kwargs, &block) }
|
48
48
|
end
|
49
49
|
|
50
50
|
if body
|
51
51
|
feature_class.define_method(name, &body)
|
52
52
|
else
|
53
|
-
feature_class.define_method(name) { raise ::ConvenientService::Feature::Plugins::CanHaveEntries::Exceptions::NotDefinedEntryMethod.new(name: __method__, feature: self) }
|
53
|
+
feature_class.define_method(name) { |*args, **kwargs, &block| ::ConvenientService.raise ::ConvenientService::Feature::Plugins::CanHaveEntries::Exceptions::NotDefinedEntryMethod.new(name: __method__, feature: self) }
|
54
|
+
end
|
55
|
+
|
56
|
+
##
|
57
|
+
# NOTE: Just `feature_class.instance_proxy_class.define_method` does NOT create a closure for `name`.
|
58
|
+
# That is why `feature_class.instance_proxy_class.class_exec` wrapper is required.
|
59
|
+
#
|
60
|
+
feature_class.instance_proxy_class.class_exec(name) do |name|
|
61
|
+
define_method(name) do |*args, **kwargs, &block|
|
62
|
+
instance_proxy_target.entry(name, *args, **kwargs, &block)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
feature_class.instance_proxy_class.define_method(:entry) do |*args, **kwargs, &block|
|
67
|
+
instance_proxy_target.entry(*args, **kwargs, &block)
|
54
68
|
end
|
55
69
|
|
56
70
|
name
|
@@ -7,14 +7,23 @@ module ConvenientService
|
|
7
7
|
module Concern
|
8
8
|
include Support::Concern
|
9
9
|
|
10
|
+
instance_methods do
|
11
|
+
##
|
12
|
+
# @return [Object] Can be any type.
|
13
|
+
#
|
14
|
+
def entry(...)
|
15
|
+
public_send(...)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
10
19
|
class_methods do
|
11
20
|
##
|
12
|
-
# @param
|
21
|
+
# @param names [Array<String, Symbol>]
|
13
22
|
# @param body [Proc, nil]
|
14
|
-
# @return [String, Symbol]
|
23
|
+
# @return [Array<String, Symbol>]
|
15
24
|
#
|
16
|
-
def entry(
|
17
|
-
Commands::
|
25
|
+
def entry(*names, &body)
|
26
|
+
Commands::DefineEntries.call(feature_class: self, names: names, body: body)
|
18
27
|
end
|
19
28
|
end
|
20
29
|
end
|
@@ -6,18 +6,28 @@ module ConvenientService
|
|
6
6
|
module CanHaveEntries
|
7
7
|
module Exceptions
|
8
8
|
class NotDefinedEntryMethod < ::ConvenientService::Exception
|
9
|
-
def
|
9
|
+
def initialize_with_kwargs(name:, feature:)
|
10
10
|
message = <<~TEXT
|
11
11
|
Entry for `#{name}` is registered inside `#{feature.class}` feature, but its corresponding method is NOT defined.
|
12
12
|
|
13
|
-
Did you forget to define it? For example:
|
13
|
+
Did you forget to define it? For example, using method form:
|
14
14
|
|
15
15
|
class #{feature.class}
|
16
16
|
entry :#{name}
|
17
17
|
|
18
18
|
# ...
|
19
19
|
|
20
|
-
def #{name}
|
20
|
+
def #{name}(...)
|
21
|
+
# ...
|
22
|
+
end
|
23
|
+
|
24
|
+
# ...
|
25
|
+
end
|
26
|
+
|
27
|
+
Or using block form:
|
28
|
+
|
29
|
+
class #{feature.class}
|
30
|
+
entry :#{name} do |*args, **kwargs, &block|
|
21
31
|
# ...
|
22
32
|
end
|
23
33
|
|
@@ -25,7 +35,7 @@ module ConvenientService
|
|
25
35
|
end
|
26
36
|
TEXT
|
27
37
|
|
28
|
-
|
38
|
+
initialize(message)
|
29
39
|
end
|
30
40
|
end
|
31
41
|
end
|