convenient_service 0.10.1 → 0.12.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 +2 -1
- data/.github/workflows/ci.yml +21 -1
- data/CHANGELOG.md +90 -0
- data/Gemfile +6 -0
- data/README.md +4 -2
- data/Taskfile.yml +94 -0
- data/convenient_service.gemspec +40 -2
- data/docker/2.7/Dockerfile +3 -3
- data/docker/3.0/Dockerfile +2 -2
- data/docker/3.1/Dockerfile +2 -2
- data/docker/3.2/Dockerfile +73 -0
- data/docker/jruby-9.4/Dockerfile +88 -0
- data/docker/truffleruby-22.3/Dockerfile +91 -0
- data/lib/convenient_service/common/plugins/aliases.rb +0 -1
- data/lib/convenient_service/common/plugins/assigns_attributes_in_constructor/using_active_model_attribute_assignment/middleware.rb +12 -8
- data/lib/convenient_service/common/plugins/caches_return_value/middleware.rb +3 -3
- data/lib/convenient_service/common/plugins/can_have_user_provided_entity/errors.rb +2 -2
- data/lib/convenient_service/common/plugins/has_around_callbacks/errors.rb +1 -1
- data/lib/convenient_service/common/plugins/has_callbacks/entities/callback.rb +7 -7
- data/lib/convenient_service/common/plugins/has_internals/entities/internals/plugins/aliases.rb +7 -0
- data/lib/convenient_service/common/plugins/has_internals/entities/internals/plugins.rb +2 -0
- data/lib/convenient_service/configs/minimal.rb +23 -4
- data/lib/convenient_service/configs/standard.rb +0 -4
- data/lib/convenient_service/core/class_methods.rb +24 -9
- data/lib/convenient_service/core/constants.rb +36 -0
- data/lib/convenient_service/core/entities/config/commands/track_method_missing_commit_trigger.rb +69 -0
- data/lib/convenient_service/core/entities/config/commands.rb +3 -0
- data/lib/convenient_service/core/entities/config/entities/concerns/entities/stack.rb +10 -10
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/chain.rb +3 -3
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware.rb +18 -1
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/middleware_creator.rb +62 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities/stack.rb +12 -12
- data/lib/convenient_service/core/entities/config/entities/method_middlewares/entities.rb +1 -0
- data/lib/convenient_service/core/entities/config/entities/method_middlewares.rb +1 -1
- data/lib/convenient_service/core/entities/config/errors.rb +38 -1
- data/lib/convenient_service/core/entities/config.rb +14 -4
- data/lib/convenient_service/core/instance_methods.rb +6 -4
- data/lib/convenient_service/core.rb +1 -0
- data/lib/convenient_service/dependencies/built_in.rb +7 -0
- data/lib/convenient_service/dependencies/extractions/active_support_concern/concern.rb +18 -2
- data/lib/convenient_service/dependencies/extractions/active_support_concern.rb +4 -0
- data/lib/convenient_service/dependencies/extractions/ruby_middleware/middleware/builder.rb +7 -1
- data/lib/convenient_service/dependencies/extractions/ruby_middleware/middleware/logger.rb +7 -1
- data/lib/convenient_service/dependencies/extractions/ruby_middleware/middleware/runner.rb +15 -1
- data/lib/convenient_service/dependencies/extractions/ruby_middleware/middleware.rb +8 -1
- data/lib/convenient_service/dependencies/extractions/ruby_middleware.rb +3 -2
- data/lib/convenient_service/dependencies.rb +16 -15
- data/lib/convenient_service/examples/dry/gemfile.rb +4 -4
- data/lib/convenient_service/examples/rails/gemfile.rb +4 -4
- data/lib/convenient_service/examples/standard/cowsay.rb +4 -4
- data/lib/convenient_service/examples/standard/gemfile/services/assert_file_exists.rb +1 -1
- data/lib/convenient_service/examples/standard/gemfile/services/assert_file_not_empty.rb +1 -1
- data/lib/convenient_service/examples/standard/gemfile/services/assert_node_available.rb +0 -9
- data/lib/convenient_service/examples/standard/gemfile.rb +4 -4
- data/lib/convenient_service/examples/standard/request_params.rb +4 -4
- data/lib/convenient_service/feature.rb +12 -0
- data/lib/convenient_service/logger.rb +6 -5
- data/lib/convenient_service/rspec/helpers/custom/in_threads.rb +74 -0
- data/lib/convenient_service/rspec/helpers/custom/stub_service/constants.rb +20 -0
- data/lib/convenient_service/rspec/helpers/custom/stub_service/entities/stubbed_service.rb +4 -4
- data/lib/convenient_service/rspec/helpers/custom/stub_service.rb +1 -0
- data/lib/convenient_service/rspec/helpers/custom/wrap_method/entities/wrapped_method.rb +3 -3
- data/lib/convenient_service/rspec/helpers/custom/wrap_method/errors.rb +1 -1
- data/lib/convenient_service/rspec/helpers/custom.rb +1 -0
- data/lib/convenient_service/rspec/helpers/in_threads.rb +13 -0
- data/lib/convenient_service/rspec/helpers.rb +2 -0
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/chainings_collection/errors.rb +3 -3
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher/entities/delegation.rb +3 -3
- data/lib/convenient_service/rspec/matchers/custom/delegate_to/entities/matcher.rb +2 -2
- data/lib/convenient_service/rspec/matchers/custom/export.rb +82 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands/find_result_method_step.rb +4 -4
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands/find_result_result_method_step.rb +4 -4
- data/lib/convenient_service/rspec/matchers/custom/results/base/commands/find_result_service_step.rb +1 -1
- data/lib/convenient_service/rspec/matchers/custom/results/base/constants.rb +22 -0
- data/lib/convenient_service/rspec/matchers/custom/results/base/errors.rb +1 -1
- data/lib/convenient_service/rspec/matchers/custom/results/base.rb +2 -1
- data/lib/convenient_service/rspec/matchers/custom.rb +1 -0
- data/lib/convenient_service/rspec/matchers/export.rb +13 -0
- data/lib/convenient_service/rspec/matchers.rb +2 -0
- data/lib/convenient_service/service/plugins/aliases.rb +0 -2
- data/lib/convenient_service/service/plugins/{has_result_method_steps → can_have_method_steps}/middleware.rb +12 -2
- data/lib/convenient_service/service/plugins/can_have_method_steps.rb +3 -0
- data/lib/convenient_service/service/plugins/can_have_result_step/middleware.rb +43 -0
- data/lib/convenient_service/service/plugins/can_have_result_step.rb +3 -0
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/commands/create_step_class.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/concern.rb +10 -10
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method.rb +92 -0
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/commands/cast_method_direction.rb +30 -3
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_factory.rb +113 -0
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/commands/define_method_in_container.rb +3 -3
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/commands.rb +1 -3
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/concern/class_methods.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/concern/instance_methods.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/concern.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/callers/alias.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/callers/base.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/callers/proc.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/callers/raw.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/callers/reassignment/commands/define_method_in_container.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/callers/reassignment.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/callers/usual.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/directions/base.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/directions/input.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/directions/output.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/base.rb +62 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/base.rb +35 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/proc_value.rb +42 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/raw_value.rb +42 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/reassignment_value.rb +42 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/string_value.rb +42 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash/symbol_value.rb +42 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/hash.rb +8 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/method.rb +40 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/reassignment.rb +40 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/string.rb +40 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories/symbol.rb +40 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/entities/factories.rb +8 -0
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/key.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/name.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/values/reassignment.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities.rb +1 -0
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/errors.rb +8 -8
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/service/class_methods.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/service.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/step/commands/cast_params.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/step/commands/extract_params.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/step/concern/instance_methods.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/step/concern.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/errors.rb +27 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/aliases.rb +7 -0
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/step/plugins/can_have_parent_result/middleware.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/step/plugins/has_inspect/concern.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/step/plugins.rb +2 -0
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/step/structs/params.rb +1 -1
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/step.rb +1 -1
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step_collection.rb +106 -0
- data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/middleware.rb +4 -4
- data/lib/convenient_service/service/plugins/can_have_steps.rb +6 -0
- data/lib/convenient_service/service/plugins/can_have_stubbed_result/concern.rb +19 -11
- data/lib/convenient_service/service/plugins/can_have_stubbed_result/middleware.rb +3 -3
- data/lib/convenient_service/service/plugins/has_result/concern/instance_methods.rb +3 -3
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/aliases.rb +7 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result/concern.rb +12 -5
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes/concern/class_methods.rb → can_have_parent_result/constants.rb} +3 -4
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/can_have_parent_result.rb +1 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes/commands/cast_jsend_attributes.rb → has_j_send_status_and_attributes/commands/cast_j_send_attributes.rb} +1 -1
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/commands/create_code_class.rb +49 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/commands/create_data_class.rb +49 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/commands/create_message_class.rb +49 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/commands/create_status_class.rb +49 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/commands.rb +7 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/concern/class_methods.rb +69 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/concern/instance_methods.rb +9 -9
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/concern.rb +1 -1
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/entities/code/concern/class_methods.rb +2 -2
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/entities/code/concern/instance_methods.rb +3 -3
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/entities/code/concern.rb +1 -1
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/entities/code.rb +1 -1
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/class_methods.rb +38 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern/instance_methods.rb +94 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/concern.rb +36 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data.rb +25 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern/class_methods.rb +40 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern/instance_methods.rb +58 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/concern.rb +36 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message.rb +25 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern/class_methods.rb +40 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern/instance_methods.rb +115 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/concern.rb +36 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status.rb +25 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/errors.rb +6 -2
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/middleware.rb +4 -4
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes/structs/jsend_attributes.rb → has_j_send_status_and_attributes/structs/j_send_attributes.rb} +1 -1
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes/structs.rb +3 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_j_send_status_and_attributes.rb +8 -0
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_result_short_syntax/concern.rb +3 -3
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/raises_on_not_checked_result_status/errors.rb +1 -1
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins.rb +3 -1
- data/lib/convenient_service/service/plugins/has_result/errors.rb +2 -2
- data/lib/convenient_service/service/plugins/has_result_status_check_short_syntax/concern.rb +16 -0
- data/lib/convenient_service/service/plugins/raises_on_double_result/errors.rb +1 -1
- data/lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/commands/format_backtrace.rb +1 -1
- data/lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/commands/format_exception.rb +11 -10
- data/lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/middleware.rb +14 -7
- data/lib/convenient_service/service/plugins.rb +3 -2
- data/lib/convenient_service/services/run_own_method_in_organizer.rb +1 -1
- data/lib/convenient_service/support/abstract_method/errors.rb +1 -1
- data/lib/convenient_service/support/arguments.rb +3 -3
- data/lib/convenient_service/support/cache/key.rb +3 -3
- data/lib/convenient_service/support/cache.rb +1 -1
- data/lib/convenient_service/support/castable/errors.rb +2 -2
- data/lib/convenient_service/support/counter.rb +212 -0
- data/lib/convenient_service/support/dependency_container/commands/assert_valid_container.rb +33 -0
- data/lib/convenient_service/support/dependency_container/commands/assert_valid_method.rb +58 -0
- data/lib/convenient_service/support/dependency_container/commands/assert_valid_scope.rb +4 -3
- data/lib/convenient_service/support/dependency_container/commands/define_entry.rb +49 -0
- data/lib/convenient_service/support/dependency_container/commands.rb +3 -0
- data/lib/convenient_service/support/dependency_container/container.rb +23 -0
- data/lib/convenient_service/support/dependency_container/entry.rb +22 -0
- data/lib/convenient_service/support/dependency_container/errors.rb +5 -5
- data/lib/convenient_service/support/dependency_container/import.rb +3 -3
- data/lib/convenient_service/support/dependency_container.rb +3 -0
- data/lib/convenient_service/support/finite_loop.rb +37 -2
- data/lib/convenient_service/support/middleware/stack_builder.rb +1 -1
- data/lib/convenient_service/support/not_passed.rb +4 -3
- data/lib/convenient_service/support/ruby.rb +31 -0
- data/lib/convenient_service/support/safe_method.rb +65 -0
- data/lib/convenient_service/support/thread_safe_counter.rb +119 -0
- data/lib/convenient_service/support/undefined.rb +4 -3
- data/lib/convenient_service/support/unique_value.rb +69 -0
- data/lib/convenient_service/support.rb +4 -0
- data/lib/convenient_service/utils/array/errors.rb +1 -1
- data/lib/convenient_service/utils/array/find_last.rb +1 -1
- data/lib/convenient_service/utils/array/find_yield.rb +1 -1
- data/lib/convenient_service/utils/object/resolve_class.rb +56 -0
- data/lib/convenient_service/utils/object.rb +9 -0
- data/lib/convenient_service/version.rb +1 -1
- data/lib/convenient_service.rb +6 -0
- metadata +129 -86
- data/lib/convenient_service/factories/arguments.rb +0 -43
- data/lib/convenient_service/factories/results.rb +0 -214
- data/lib/convenient_service/factories/services.rb +0 -189
- data/lib/convenient_service/factories/step/instance.rb +0 -32
- data/lib/convenient_service/factories/step.rb +0 -3
- data/lib/convenient_service/factories/steps.rb +0 -126
- data/lib/convenient_service/factories.rb +0 -22
- data/lib/convenient_service/factory.rb +0 -21
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/commands.rb +0 -3
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/data/class_methods.rb +0 -32
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/data.rb +0 -74
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/message/class_methods.rb +0 -34
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/message.rb +0 -45
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/status/class_methods.rb +0 -34
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/entities/status.rb +0 -77
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes/structs.rb +0 -3
- data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/has_jsend_status_and_attributes.rb +0 -8
- data/lib/convenient_service/service/plugins/has_result_method_steps.rb +0 -3
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands/cast_method.rb +0 -57
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands/cast_method_caller.rb +0 -74
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands/cast_method_key.rb +0 -78
- data/lib/convenient_service/service/plugins/has_result_steps/entities/method/commands/cast_method_name.rb +0 -78
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step/errors.rb +0 -23
- data/lib/convenient_service/service/plugins/has_result_steps/entities/step_collection.rb +0 -77
- data/lib/convenient_service/service/plugins/has_result_steps.rb +0 -6
- /data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/commands.rb +0 -0
- /data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/callers/reassignment/commands.rb +0 -0
- /data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/callers.rb +0 -0
- /data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/directions.rb +0 -0
- /data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/method/entities/values.rb +0 -0
- /data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/step/commands.rb +0 -0
- /data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/step/plugins/can_have_parent_result.rb +0 -0
- /data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/step/plugins/has_inspect.rb +0 -0
- /data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities/step/structs.rb +0 -0
- /data/lib/convenient_service/service/plugins/{has_result_steps → can_have_steps}/entities.rb +0 -0
- /data/lib/convenient_service/service/plugins/has_result/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/entities.rb +0 -0
@@ -7,6 +7,19 @@ module ConvenientService
|
|
7
7
|
module Concern
|
8
8
|
include Support::Concern
|
9
9
|
|
10
|
+
included do |service_class|
|
11
|
+
service_class.extend ClassMethods
|
12
|
+
|
13
|
+
##
|
14
|
+
# IMPORTANT:
|
15
|
+
# - Initializes `stubbed_results` during the `include Concern` process.
|
16
|
+
# - Tries to enforce thread-safety in such a way.
|
17
|
+
# - https://github.com/ruby/spec/blob/master/core/module/include_spec.rb
|
18
|
+
# - https://github.com/ruby/ruby/blob/master/class.c
|
19
|
+
#
|
20
|
+
service_class.stubbed_results
|
21
|
+
end
|
22
|
+
|
10
23
|
class_methods do
|
11
24
|
##
|
12
25
|
# @return [ConvenientService::Support::Cache]
|
@@ -17,16 +30,8 @@ module ConvenientService
|
|
17
30
|
# - https://github.com/rspec/rspec-core/blob/v3.12.0/lib/rspec/core.rb#L122
|
18
31
|
# - https://relishapp.com/rspec/rspec-core/docs/metadata/current-example
|
19
32
|
#
|
20
|
-
# TODO: Mutex for thread-safety when parallel steps will be supported.
|
21
|
-
#
|
22
33
|
def stubbed_results
|
23
|
-
return Support::Cache.new unless Support::Gems::RSpec.current_example
|
24
|
-
|
25
34
|
##
|
26
|
-
# IMPORTANT: ivar name with class and current thread enforces thread safety since there is no resource to share.
|
27
|
-
#
|
28
|
-
# TODO: Thread safety specs.
|
29
|
-
#
|
30
35
|
# NOTE: `self` is a service class in the current context. For example:
|
31
36
|
#
|
32
37
|
# before do
|
@@ -37,9 +42,12 @@ module ConvenientService
|
|
37
42
|
#
|
38
43
|
# # Then `self` is `ConvenientService::Examples::Standard::Gemfile::Services::RunShell`.
|
39
44
|
#
|
40
|
-
|
41
|
-
|
42
|
-
|
45
|
+
cache =
|
46
|
+
if Support::Gems::RSpec.current_example
|
47
|
+
Utils::Object.instance_variable_fetch(Support::Gems::RSpec.current_example, :@__convenient_service_stubbed_results__) { Support::Cache.new }
|
48
|
+
else
|
49
|
+
Support::Cache.new
|
50
|
+
end
|
43
51
|
|
44
52
|
cache.scope(self)
|
45
53
|
end
|
@@ -6,9 +6,9 @@ module ConvenientService
|
|
6
6
|
module CanHaveStubbedResult
|
7
7
|
class Middleware < Core::MethodChainMiddleware
|
8
8
|
##
|
9
|
-
# @param args [Array]
|
10
|
-
# @param kwargs [Hash]
|
11
|
-
# @param block [Proc]
|
9
|
+
# @param args [Array<Object>]
|
10
|
+
# @param kwargs [Hash{Symbol => Object}]
|
11
|
+
# @param block [Proc, nil]
|
12
12
|
# @return [Object] Can be any type.
|
13
13
|
#
|
14
14
|
def next(*args, **kwargs, &block)
|
@@ -16,7 +16,7 @@ module ConvenientService
|
|
16
16
|
|
17
17
|
##
|
18
18
|
# @api public
|
19
|
-
# @param kwargs [Hash]
|
19
|
+
# @param kwargs [Hash{Symbol => Object}]
|
20
20
|
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result]
|
21
21
|
#
|
22
22
|
def success(**kwargs)
|
@@ -25,7 +25,7 @@ module ConvenientService
|
|
25
25
|
|
26
26
|
##
|
27
27
|
# @api public
|
28
|
-
# @param kwargs [Hash]
|
28
|
+
# @param kwargs [Hash{Symbol => Object}]
|
29
29
|
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result]
|
30
30
|
#
|
31
31
|
def failure(**kwargs)
|
@@ -34,7 +34,7 @@ module ConvenientService
|
|
34
34
|
|
35
35
|
##
|
36
36
|
# @api public
|
37
|
-
# @param kwargs [Hash]
|
37
|
+
# @param kwargs [Hash{Symbol => Object}]
|
38
38
|
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result]
|
39
39
|
#
|
40
40
|
def error(**kwargs)
|
@@ -16,11 +16,12 @@ module ConvenientService
|
|
16
16
|
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result, nil]
|
17
17
|
#
|
18
18
|
def parent
|
19
|
-
|
19
|
+
Utils::Object.memoize_including_falsy_values(self, :@parent) { internals.cache[:parent] }
|
20
20
|
end
|
21
21
|
|
22
22
|
##
|
23
23
|
# @param include_self [Boolean]
|
24
|
+
# @param limit [Integer]
|
24
25
|
# @return [Array<ConvenientService::Service::Plugins::HasResult::Entities::Result>]
|
25
26
|
#
|
26
27
|
# @internal
|
@@ -46,17 +47,18 @@ module ConvenientService
|
|
46
47
|
# parents
|
47
48
|
# end
|
48
49
|
#
|
49
|
-
def parents(include_self: false)
|
50
|
-
parents_enum(include_self: include_self).to_a
|
50
|
+
def parents(include_self: false, limit: Constants::PARENTS_LIMIT)
|
51
|
+
parents_enum(include_self: include_self, limit: limit).to_a
|
51
52
|
end
|
52
53
|
|
53
54
|
##
|
54
55
|
# @param include_self [Boolean]
|
56
|
+
# @param limit [Integer]
|
55
57
|
# @return [Enumerator<ConvenientService::Service::Plugins::HasResult::Entities::Result>]
|
56
58
|
#
|
57
59
|
# @see https://ruby-doc.org/core-2.7.0/Enumerator.html
|
58
60
|
#
|
59
|
-
def parents_enum(include_self: false)
|
61
|
+
def parents_enum(include_self: false, limit: Constants::PARENTS_LIMIT)
|
60
62
|
::Enumerator.new do |yielder|
|
61
63
|
yielder.yield(self) if include_self
|
62
64
|
|
@@ -66,7 +68,12 @@ module ConvenientService
|
|
66
68
|
#
|
67
69
|
parent = parent()
|
68
70
|
|
69
|
-
|
71
|
+
##
|
72
|
+
# NOTE: `finite_loop` is used to avoid even a theoretical infinite loop.
|
73
|
+
#
|
74
|
+
Support::FiniteLoop.finite_loop(max_iteration_count: limit, raise_on_exceedance: false) do
|
75
|
+
break unless parent
|
76
|
+
|
70
77
|
yielder.yield(parent)
|
71
78
|
|
72
79
|
parent = parent.parent
|
@@ -7,10 +7,9 @@ module ConvenientService
|
|
7
7
|
module Entities
|
8
8
|
class Result
|
9
9
|
module Plugins
|
10
|
-
module
|
11
|
-
module
|
12
|
-
|
13
|
-
end
|
10
|
+
module CanHaveParentResult
|
11
|
+
module Constants
|
12
|
+
PARENTS_LIMIT = 1_000
|
14
13
|
end
|
15
14
|
end
|
16
15
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Service
|
5
|
+
module Plugins
|
6
|
+
module HasResult
|
7
|
+
module Entities
|
8
|
+
class Result
|
9
|
+
module Plugins
|
10
|
+
module HasJSendStatusAndAttributes
|
11
|
+
module Commands
|
12
|
+
class CreateCodeClass < Support::Command
|
13
|
+
include Support::DependencyContainer::Import
|
14
|
+
|
15
|
+
##
|
16
|
+
# @!attribute [r] result_class
|
17
|
+
# @return Class
|
18
|
+
#
|
19
|
+
attr_reader :result_class
|
20
|
+
|
21
|
+
##
|
22
|
+
# @return Class
|
23
|
+
#
|
24
|
+
import :"commands.FindOrCreateEntity", from: Common::Plugins::CanHaveUserProvidedEntity::Container
|
25
|
+
|
26
|
+
##
|
27
|
+
# @param result_class [Class]
|
28
|
+
# @return [void]
|
29
|
+
#
|
30
|
+
def initialize(result_class:)
|
31
|
+
@result_class = result_class
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# @return [Class]
|
36
|
+
#
|
37
|
+
def call
|
38
|
+
commands.FindOrCreateEntity.call(namespace: result_class, proto_entity: Entities::Code)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Service
|
5
|
+
module Plugins
|
6
|
+
module HasResult
|
7
|
+
module Entities
|
8
|
+
class Result
|
9
|
+
module Plugins
|
10
|
+
module HasJSendStatusAndAttributes
|
11
|
+
module Commands
|
12
|
+
class CreateDataClass < Support::Command
|
13
|
+
include Support::DependencyContainer::Import
|
14
|
+
|
15
|
+
##
|
16
|
+
# @!attribute [r] result_class
|
17
|
+
# @return Class
|
18
|
+
#
|
19
|
+
attr_reader :result_class
|
20
|
+
|
21
|
+
##
|
22
|
+
# @return Class
|
23
|
+
#
|
24
|
+
import :"commands.FindOrCreateEntity", from: Common::Plugins::CanHaveUserProvidedEntity::Container
|
25
|
+
|
26
|
+
##
|
27
|
+
# @param result_class [Class]
|
28
|
+
# @return [void]
|
29
|
+
#
|
30
|
+
def initialize(result_class:)
|
31
|
+
@result_class = result_class
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# @return [Class]
|
36
|
+
#
|
37
|
+
def call
|
38
|
+
commands.FindOrCreateEntity.call(namespace: result_class, proto_entity: Entities::Data)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Service
|
5
|
+
module Plugins
|
6
|
+
module HasResult
|
7
|
+
module Entities
|
8
|
+
class Result
|
9
|
+
module Plugins
|
10
|
+
module HasJSendStatusAndAttributes
|
11
|
+
module Commands
|
12
|
+
class CreateMessageClass < Support::Command
|
13
|
+
include Support::DependencyContainer::Import
|
14
|
+
|
15
|
+
##
|
16
|
+
# @!attribute [r] result_class
|
17
|
+
# @return Class
|
18
|
+
#
|
19
|
+
attr_reader :result_class
|
20
|
+
|
21
|
+
##
|
22
|
+
# @return Class
|
23
|
+
#
|
24
|
+
import :"commands.FindOrCreateEntity", from: Common::Plugins::CanHaveUserProvidedEntity::Container
|
25
|
+
|
26
|
+
##
|
27
|
+
# @param result_class [Class]
|
28
|
+
# @return [void]
|
29
|
+
#
|
30
|
+
def initialize(result_class:)
|
31
|
+
@result_class = result_class
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# @return [Class]
|
36
|
+
#
|
37
|
+
def call
|
38
|
+
commands.FindOrCreateEntity.call(namespace: result_class, proto_entity: Entities::Message)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Service
|
5
|
+
module Plugins
|
6
|
+
module HasResult
|
7
|
+
module Entities
|
8
|
+
class Result
|
9
|
+
module Plugins
|
10
|
+
module HasJSendStatusAndAttributes
|
11
|
+
module Commands
|
12
|
+
class CreateStatusClass < Support::Command
|
13
|
+
include Support::DependencyContainer::Import
|
14
|
+
|
15
|
+
##
|
16
|
+
# @!attribute [r] result_class
|
17
|
+
# @return Class
|
18
|
+
#
|
19
|
+
attr_reader :result_class
|
20
|
+
|
21
|
+
##
|
22
|
+
# @return Class
|
23
|
+
#
|
24
|
+
import :"commands.FindOrCreateEntity", from: Common::Plugins::CanHaveUserProvidedEntity::Container
|
25
|
+
|
26
|
+
##
|
27
|
+
# @param result_class [Class]
|
28
|
+
# @return [void]
|
29
|
+
#
|
30
|
+
def initialize(result_class:)
|
31
|
+
@result_class = result_class
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# @return [Class]
|
36
|
+
#
|
37
|
+
def call
|
38
|
+
commands.FindOrCreateEntity.call(namespace: result_class, proto_entity: Entities::Status)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "commands/cast_j_send_attributes"
|
4
|
+
require_relative "commands/create_code_class"
|
5
|
+
require_relative "commands/create_data_class"
|
6
|
+
require_relative "commands/create_message_class"
|
7
|
+
require_relative "commands/create_status_class"
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Service
|
5
|
+
module Plugins
|
6
|
+
module HasResult
|
7
|
+
module Entities
|
8
|
+
class Result
|
9
|
+
module Plugins
|
10
|
+
module HasJSendStatusAndAttributes
|
11
|
+
module Concern
|
12
|
+
module ClassMethods
|
13
|
+
##
|
14
|
+
# @api private
|
15
|
+
# @return [Class]
|
16
|
+
#
|
17
|
+
# @internal
|
18
|
+
# NOTE: A command instead of `import` is used in order to NOT pollute the public interface.
|
19
|
+
# TODO: Specs that prevent public interface accidental pollution.
|
20
|
+
#
|
21
|
+
def code_class
|
22
|
+
@code_class ||= Commands::CreateCodeClass.call(result_class: self)
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# @api private
|
27
|
+
# @return [Class]
|
28
|
+
#
|
29
|
+
# @internal
|
30
|
+
# NOTE: A command instead of `import` is used in order to NOT pollute the public interface.
|
31
|
+
# TODO: Specs that prevent public interface accidental pollution.
|
32
|
+
#
|
33
|
+
def data_class
|
34
|
+
@data_class ||= Commands::CreateDataClass.call(result_class: self)
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# @api private
|
39
|
+
# @return [Class]
|
40
|
+
#
|
41
|
+
# @internal
|
42
|
+
# NOTE: A command instead of `import` is used in order to NOT pollute the public interface.
|
43
|
+
# TODO: Specs that prevent public interface accidental pollution.
|
44
|
+
#
|
45
|
+
def message_class
|
46
|
+
@message_class ||= Commands::CreateMessageClass.call(result_class: self)
|
47
|
+
end
|
48
|
+
|
49
|
+
##
|
50
|
+
# @api private
|
51
|
+
# @return [Class]
|
52
|
+
#
|
53
|
+
# @internal
|
54
|
+
# NOTE: A command instead of `import` is used in order to NOT pollute the public interface.
|
55
|
+
# TODO: Specs that prevent public interface accidental pollution.
|
56
|
+
#
|
57
|
+
def status_class
|
58
|
+
@status_class ||= Commands::CreateStatusClass.call(result_class: self)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -7,7 +7,7 @@ module ConvenientService
|
|
7
7
|
module Entities
|
8
8
|
class Result
|
9
9
|
module Plugins
|
10
|
-
module
|
10
|
+
module HasJSendStatusAndAttributes
|
11
11
|
module Concern
|
12
12
|
##
|
13
13
|
# TODO: How to use concern outside?
|
@@ -52,42 +52,42 @@ module ConvenientService
|
|
52
52
|
delegate :service, to: :jsend_attributes
|
53
53
|
|
54
54
|
##
|
55
|
-
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::
|
55
|
+
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Status]
|
56
56
|
#
|
57
57
|
delegate :status, to: :jsend_attributes
|
58
58
|
|
59
59
|
##
|
60
|
-
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::
|
60
|
+
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Data]
|
61
61
|
#
|
62
62
|
delegate :data, to: :jsend_attributes
|
63
63
|
|
64
64
|
##
|
65
|
-
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::
|
65
|
+
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Data]
|
66
66
|
#
|
67
67
|
alias_method :unsafe_data, :data
|
68
68
|
|
69
69
|
##
|
70
|
-
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::
|
70
|
+
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Message]
|
71
71
|
#
|
72
72
|
delegate :message, to: :jsend_attributes
|
73
73
|
|
74
74
|
##
|
75
|
-
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::
|
75
|
+
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Message]
|
76
76
|
#
|
77
77
|
alias_method :unsafe_message, :message
|
78
78
|
|
79
79
|
##
|
80
|
-
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::
|
80
|
+
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Code]
|
81
81
|
#
|
82
82
|
delegate :code, to: :jsend_attributes
|
83
83
|
|
84
84
|
##
|
85
|
-
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::
|
85
|
+
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Code]
|
86
86
|
#
|
87
87
|
alias_method :unsafe_code, :code
|
88
88
|
|
89
89
|
##
|
90
|
-
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::
|
90
|
+
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Structs::JSendAttributes]
|
91
91
|
#
|
92
92
|
def jsend_attributes
|
93
93
|
internals.cache[:jsend_attributes]
|
@@ -7,14 +7,14 @@ module ConvenientService
|
|
7
7
|
module Entities
|
8
8
|
class Result
|
9
9
|
module Plugins
|
10
|
-
module
|
10
|
+
module HasJSendStatusAndAttributes
|
11
11
|
module Entities
|
12
12
|
class Code
|
13
13
|
module Concern
|
14
14
|
module ClassMethods
|
15
15
|
##
|
16
16
|
# @param other [Object] Can be any type.
|
17
|
-
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::
|
17
|
+
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Code, nil]
|
18
18
|
#
|
19
19
|
def cast(other)
|
20
20
|
case other
|
@@ -7,13 +7,13 @@ module ConvenientService
|
|
7
7
|
module Entities
|
8
8
|
class Result
|
9
9
|
module Plugins
|
10
|
-
module
|
10
|
+
module HasJSendStatusAndAttributes
|
11
11
|
module Entities
|
12
12
|
class Code
|
13
13
|
module Concern
|
14
14
|
module InstanceMethods
|
15
15
|
##
|
16
|
-
# @!attribute
|
16
|
+
# @!attribute [r] value
|
17
17
|
# @return [Symbol]
|
18
18
|
#
|
19
19
|
attr_reader :value
|
@@ -28,7 +28,7 @@ module ConvenientService
|
|
28
28
|
|
29
29
|
##
|
30
30
|
# @param other [Object] Can be any type.
|
31
|
-
# @return [Boolean]
|
31
|
+
# @return [Boolean, nil]
|
32
32
|
#
|
33
33
|
def ==(other)
|
34
34
|
casted = cast(other)
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Service
|
5
|
+
module Plugins
|
6
|
+
module HasResult
|
7
|
+
module Entities
|
8
|
+
class Result
|
9
|
+
module Plugins
|
10
|
+
module HasJSendStatusAndAttributes
|
11
|
+
module Entities
|
12
|
+
class Data
|
13
|
+
module Concern
|
14
|
+
module ClassMethods
|
15
|
+
##
|
16
|
+
# @param other [Object] Can be any type.
|
17
|
+
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Data, nil]
|
18
|
+
#
|
19
|
+
def cast(other)
|
20
|
+
case other
|
21
|
+
when ::Hash
|
22
|
+
new(value: other.transform_keys(&:to_sym))
|
23
|
+
when Data
|
24
|
+
new(value: other.value)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|