convenient_service 0.11.0 → 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 +67 -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 +19 -10
- 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/services/assert_npm_package_available.rb +0 -10
- data/lib/convenient_service/examples/standard/gemfile/services/format.rb +0 -10
- data/lib/convenient_service/examples/standard/gemfile/services/merge_sections.rb +0 -10
- data/lib/convenient_service/examples/standard/gemfile/services/parse_content.rb +0 -10
- data/lib/convenient_service/examples/standard/gemfile/services/read_file_content.rb +0 -10
- data/lib/convenient_service/examples/standard/gemfile/services/replace_file_content.rb +0 -10
- data/lib/convenient_service/examples/standard/gemfile.rb +4 -4
- data/lib/convenient_service/examples/standard/request_params/services/extract_params_from_body.rb +0 -10
- data/lib/convenient_service/examples/standard/request_params/services/extract_params_from_path.rb +0 -10
- data/lib/convenient_service/examples/standard/request_params/services/validate_casted_params.rb +0 -10
- data/lib/convenient_service/examples/standard/request_params/services/validate_uncasted_params.rb +0 -10
- 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/export.rb +82 -0
- 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/can_have_method_steps/middleware.rb +2 -2
- data/lib/convenient_service/service/plugins/can_have_result_step/middleware.rb +2 -2
- data/lib/convenient_service/service/plugins/can_have_steps/concern.rb +2 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method.rb +46 -11
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_direction.rb +29 -2
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_factory.rb +113 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands.rb +1 -3
- 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/can_have_steps/entities/method/entities.rb +1 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/errors.rb +7 -7
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/errors.rb +12 -8
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins/aliases.rb +7 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step/plugins.rb +2 -0
- data/lib/convenient_service/service/plugins/can_have_steps/entities/step_collection.rb +37 -8
- 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/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 +75 -34
- 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 -229
- data/lib/convenient_service/factories/step/instance.rb +0 -42
- 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/can_have_steps/entities/method/commands/cast_method_caller.rb +0 -74
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_key.rb +0 -78
- data/lib/convenient_service/service/plugins/can_have_steps/entities/method/commands/cast_method_name.rb +0 -78
- 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/entities/result/plugins/{has_jsend_status_and_attributes → has_j_send_status_and_attributes}/entities.rb +0 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "concern/class_methods"
|
4
|
+
require_relative "concern/instance_methods"
|
5
|
+
|
6
|
+
module ConvenientService
|
7
|
+
module Service
|
8
|
+
module Plugins
|
9
|
+
module HasResult
|
10
|
+
module Entities
|
11
|
+
class Result
|
12
|
+
module Plugins
|
13
|
+
module HasJSendStatusAndAttributes
|
14
|
+
module Entities
|
15
|
+
class Status
|
16
|
+
module Concern
|
17
|
+
include Support::Concern
|
18
|
+
|
19
|
+
included do |code_class|
|
20
|
+
code_class.include Support::Castable
|
21
|
+
|
22
|
+
code_class.include InstanceMethods
|
23
|
+
|
24
|
+
code_class.extend ClassMethods
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "status/concern"
|
4
|
+
|
5
|
+
module ConvenientService
|
6
|
+
module Service
|
7
|
+
module Plugins
|
8
|
+
module HasResult
|
9
|
+
module Entities
|
10
|
+
class Result
|
11
|
+
module Plugins
|
12
|
+
module HasJSendStatusAndAttributes
|
13
|
+
module Entities
|
14
|
+
class Status
|
15
|
+
include Concern
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -7,9 +7,13 @@ module ConvenientService
|
|
7
7
|
module Entities
|
8
8
|
class Result
|
9
9
|
module Plugins
|
10
|
-
module
|
10
|
+
module HasJSendStatusAndAttributes
|
11
11
|
module Errors
|
12
|
-
class NotExistingAttribute < ConvenientService::Error
|
12
|
+
class NotExistingAttribute < ::ConvenientService::Error
|
13
|
+
##
|
14
|
+
# @param attribute [Symbol]
|
15
|
+
# @return [void]
|
16
|
+
#
|
13
17
|
def initialize(attribute:)
|
14
18
|
message = <<~TEXT
|
15
19
|
Data attribute `#{attribute}` does NOT exist. Make sure the corresponding result returns it.
|
@@ -7,12 +7,12 @@ module ConvenientService
|
|
7
7
|
module Entities
|
8
8
|
class Result
|
9
9
|
module Plugins
|
10
|
-
module
|
10
|
+
module HasJSendStatusAndAttributes
|
11
11
|
class Middleware < Core::MethodChainMiddleware
|
12
12
|
##
|
13
|
-
# @param args [Array]
|
14
|
-
# @param kwargs [Hash]
|
15
|
-
# @param block [Proc]
|
13
|
+
# @param args [Array<Object>]
|
14
|
+
# @param kwargs [Hash{Symbol => Object}]
|
15
|
+
# @param block [Proc, nil]
|
16
16
|
# @return [void]
|
17
17
|
#
|
18
18
|
def next(*args, **kwargs, &block)
|
@@ -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 Structs
|
12
12
|
JSendAttributes = ::Struct.new(:service, :status, :data, :message, :code, keyword_init: true)
|
13
13
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "has_j_send_status_and_attributes/commands"
|
4
|
+
require_relative "has_j_send_status_and_attributes/concern"
|
5
|
+
require_relative "has_j_send_status_and_attributes/entities"
|
6
|
+
require_relative "has_j_send_status_and_attributes/errors"
|
7
|
+
require_relative "has_j_send_status_and_attributes/middleware"
|
8
|
+
require_relative "has_j_send_status_and_attributes/structs"
|
@@ -31,21 +31,21 @@ module ConvenientService
|
|
31
31
|
end
|
32
32
|
|
33
33
|
##
|
34
|
-
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::
|
34
|
+
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Data]
|
35
35
|
#
|
36
36
|
def ud
|
37
37
|
unsafe_data
|
38
38
|
end
|
39
39
|
|
40
40
|
##
|
41
|
-
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::
|
41
|
+
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Message]
|
42
42
|
#
|
43
43
|
def um
|
44
44
|
unsafe_message
|
45
45
|
end
|
46
46
|
|
47
47
|
##
|
48
|
-
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::
|
48
|
+
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result::Plugins::HasJSendStatusAndAttributes::Entities::Code]
|
49
49
|
#
|
50
50
|
def uc
|
51
51
|
unsafe_code
|
@@ -9,7 +9,7 @@ module ConvenientService
|
|
9
9
|
module Plugins
|
10
10
|
module RaisesOnNotCheckedResultStatus
|
11
11
|
module Errors
|
12
|
-
class StatusIsNotChecked < ConvenientService::Error
|
12
|
+
class StatusIsNotChecked < ::ConvenientService::Error
|
13
13
|
def initialize(attribute:)
|
14
14
|
message = <<~TEXT
|
15
15
|
Attribute `#{attribute}` is accessed before result status is checked.
|
@@ -1,10 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "plugins/can_recalculate_result"
|
4
|
-
require_relative "plugins/
|
4
|
+
require_relative "plugins/has_j_send_status_and_attributes"
|
5
5
|
require_relative "plugins/has_inspect"
|
6
6
|
require_relative "plugins/has_step"
|
7
7
|
require_relative "plugins/can_have_parent_result"
|
8
8
|
require_relative "plugins/has_result_short_syntax"
|
9
9
|
require_relative "plugins/marks_result_status_as_checked"
|
10
10
|
require_relative "plugins/raises_on_not_checked_result_status"
|
11
|
+
|
12
|
+
require_relative "plugins/aliases"
|
@@ -5,7 +5,7 @@ module ConvenientService
|
|
5
5
|
module Plugins
|
6
6
|
module HasResult
|
7
7
|
module Errors
|
8
|
-
class ResultIsNotOverridden < ConvenientService::Error
|
8
|
+
class ResultIsNotOverridden < ::ConvenientService::Error
|
9
9
|
def initialize(service:)
|
10
10
|
message = <<~TEXT
|
11
11
|
Result method (#result) of `#{service.class}` is NOT overridden.
|
@@ -15,7 +15,7 @@ module ConvenientService
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
class ServiceReturnValueNotKindOfResult < ConvenientService::Error
|
18
|
+
class ServiceReturnValueNotKindOfResult < ::ConvenientService::Error
|
19
19
|
def initialize(service:, result:)
|
20
20
|
message = <<~TEXT
|
21
21
|
Return value of service `#{service.class}` is NOT a `Result`.
|
@@ -55,6 +55,22 @@ module ConvenientService
|
|
55
55
|
def not_failure?(...)
|
56
56
|
result(...).not_failure?
|
57
57
|
end
|
58
|
+
|
59
|
+
##
|
60
|
+
# @return [Boolean]
|
61
|
+
# @since 0.12.0
|
62
|
+
#
|
63
|
+
def ok?(...)
|
64
|
+
result(...).success?
|
65
|
+
end
|
66
|
+
|
67
|
+
##
|
68
|
+
# @return [Boolean]
|
69
|
+
# @since 0.12.0
|
70
|
+
#
|
71
|
+
def not_ok?(...)
|
72
|
+
result(...).not_success?
|
73
|
+
end
|
58
74
|
end
|
59
75
|
end
|
60
76
|
end
|
@@ -5,7 +5,7 @@ module ConvenientService
|
|
5
5
|
module Plugins
|
6
6
|
module RaisesOnDoubleResult
|
7
7
|
module Errors
|
8
|
-
class DoubleResult < ConvenientService::Error
|
8
|
+
class DoubleResult < ::ConvenientService::Error
|
9
9
|
def initialize(service:)
|
10
10
|
message = <<~TEXT
|
11
11
|
`#{service.class}` service has a double result.
|
@@ -28,7 +28,7 @@ module ConvenientService
|
|
28
28
|
# - https://blog.kalina.tech/2019/04/exception-without-backtrace-in-ruby.html
|
29
29
|
# - https://github.com/jruby/jruby/issues/4467
|
30
30
|
#
|
31
|
-
def initialize(backtrace:, max_size:)
|
31
|
+
def initialize(backtrace:, max_size: Constants::DEFAULT_MAX_BACKTRACE_SIZE)
|
32
32
|
@backtrace = backtrace.to_a
|
33
33
|
@max_size = max_size
|
34
34
|
end
|
@@ -12,6 +12,12 @@ module ConvenientService
|
|
12
12
|
#
|
13
13
|
attr_reader :exception
|
14
14
|
|
15
|
+
##
|
16
|
+
# @!attribute [r] max_backtrace_size
|
17
|
+
# @return [Integer]
|
18
|
+
#
|
19
|
+
attr_reader :max_backtrace_size
|
20
|
+
|
15
21
|
##
|
16
22
|
# @!attribute [r] args
|
17
23
|
# @return [StandardError]
|
@@ -32,16 +38,18 @@ module ConvenientService
|
|
32
38
|
|
33
39
|
##
|
34
40
|
# @param exception [StandardError]
|
35
|
-
# @param args [Array]
|
36
|
-
# @param kwargs [Hash]
|
41
|
+
# @param args [Array<Object>]
|
42
|
+
# @param kwargs [Hash{Symbol => Object}]
|
37
43
|
# @param block [Proc, nil]
|
44
|
+
# @param max_backtrace_size [Integer]
|
38
45
|
# @return [void]
|
39
46
|
#
|
40
|
-
def initialize(exception:, args:, kwargs:, block:)
|
47
|
+
def initialize(exception:, args:, kwargs:, block:, max_backtrace_size: Constants::DEFAULT_MAX_BACKTRACE_SIZE)
|
41
48
|
@exception = exception
|
42
49
|
@args = args
|
43
50
|
@kwargs = kwargs
|
44
51
|
@block = block
|
52
|
+
@max_backtrace_size = max_backtrace_size
|
45
53
|
end
|
46
54
|
|
47
55
|
##
|
@@ -179,13 +187,6 @@ module ConvenientService
|
|
179
187
|
def formatted_exception_cause
|
180
188
|
Commands::FormatCause.call(cause: exception.cause)
|
181
189
|
end
|
182
|
-
|
183
|
-
##
|
184
|
-
# @return [Integer]
|
185
|
-
#
|
186
|
-
def max_backtrace_size
|
187
|
-
Constants::DEFAULT_MAX_BACKTRACE_SIZE
|
188
|
-
end
|
189
190
|
end
|
190
191
|
end
|
191
192
|
end
|
data/lib/convenient_service/service/plugins/rescues_result_unhandled_exceptions/middleware.rb
CHANGED
@@ -6,8 +6,8 @@ module ConvenientService
|
|
6
6
|
module RescuesResultUnhandledExceptions
|
7
7
|
class Middleware < Core::MethodChainMiddleware
|
8
8
|
##
|
9
|
-
# @param args [Array]
|
10
|
-
# @param kwargs [Hash]
|
9
|
+
# @param args [Array<Object>]
|
10
|
+
# @param kwargs [Hash{Symbol => Object}]
|
11
11
|
# @param block [Proc, nil]
|
12
12
|
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result]
|
13
13
|
#
|
@@ -29,8 +29,8 @@ module ConvenientService
|
|
29
29
|
|
30
30
|
##
|
31
31
|
# @param exception [StandardError]
|
32
|
-
# @param args [Array]
|
33
|
-
# @param kwargs [Hash]
|
32
|
+
# @param args [Array<Object>]
|
33
|
+
# @param kwargs [Hash{Symbol => Object}]
|
34
34
|
# @param block [Proc, nil]
|
35
35
|
# @return [ConvenientService::Service::Plugins::HasResult::Entities::Result]
|
36
36
|
#
|
@@ -43,13 +43,20 @@ module ConvenientService
|
|
43
43
|
|
44
44
|
##
|
45
45
|
# @param exception [StandardError]
|
46
|
-
# @param args [Array]
|
47
|
-
# @param kwargs [Hash]
|
46
|
+
# @param args [Array<Object>]
|
47
|
+
# @param kwargs [Hash{Symbol => Object}]
|
48
48
|
# @param block [Proc, nil]
|
49
49
|
# @return [String]
|
50
50
|
#
|
51
51
|
def format_exception(exception, *args, **kwargs, &block)
|
52
|
-
Commands::FormatException.call(exception: exception, args: args, kwargs: kwargs, block: block)
|
52
|
+
Commands::FormatException.call(exception: exception, args: args, kwargs: kwargs, block: block, max_backtrace_size: max_backtrace_size)
|
53
|
+
end
|
54
|
+
|
55
|
+
##
|
56
|
+
# @return [Integer]
|
57
|
+
#
|
58
|
+
def max_backtrace_size
|
59
|
+
arguments.kwargs.fetch(:max_backtrace_size) { Constants::DEFAULT_MAX_BACKTRACE_SIZE }
|
53
60
|
end
|
54
61
|
end
|
55
62
|
end
|
@@ -4,7 +4,7 @@ module ConvenientService
|
|
4
4
|
module Services
|
5
5
|
class RunOwnMethodInOrganizer
|
6
6
|
module Errors
|
7
|
-
class MethodForStepIsNotDefined < ConvenientService::Error
|
7
|
+
class MethodForStepIsNotDefined < ::ConvenientService::Error
|
8
8
|
def initialize(service_class:, method_name:)
|
9
9
|
message = <<~TEXT
|
10
10
|
Service #{service_class} tries to use `#{method_name}` method in a step, but it NOT defined.
|
@@ -4,7 +4,7 @@ module ConvenientService
|
|
4
4
|
module Support
|
5
5
|
module AbstractMethod
|
6
6
|
module Errors
|
7
|
-
class AbstractMethodNotOverridden < ::
|
7
|
+
class AbstractMethodNotOverridden < ::ConvenientService::Error
|
8
8
|
def initialize(instance:, method:)
|
9
9
|
klass = instance.is_a?(::Class) ? instance : instance.class
|
10
10
|
method_type = Utils::Object.resolve_type(instance)
|
@@ -24,9 +24,9 @@ module ConvenientService
|
|
24
24
|
attr_reader :block
|
25
25
|
|
26
26
|
##
|
27
|
-
# @param args [Array]
|
28
|
-
# @param kwargs [Hash]
|
29
|
-
# @param block [Proc]
|
27
|
+
# @param args [Array<Object>]
|
28
|
+
# @param kwargs [Hash{Symbol => Object}]
|
29
|
+
# @param block [Proc, nil]
|
30
30
|
# @return [void]
|
31
31
|
#
|
32
32
|
def initialize(*args, **kwargs, &block)
|
@@ -5,9 +5,9 @@ module ConvenientService
|
|
5
5
|
class Cache
|
6
6
|
class Key
|
7
7
|
##
|
8
|
-
# @param args [Array]
|
9
|
-
# @param kwargs [Hash]
|
10
|
-
# @param block [Proc]
|
8
|
+
# @param args [Array<Object>]
|
9
|
+
# @param kwargs [Hash{Symbol => Object}]
|
10
|
+
# @param block [Proc, nil]
|
11
11
|
# @return [void]
|
12
12
|
#
|
13
13
|
def initialize(*args, **kwargs, &block)
|
@@ -4,7 +4,7 @@ module ConvenientService
|
|
4
4
|
module Support
|
5
5
|
module Castable
|
6
6
|
module Errors
|
7
|
-
class CastIsNotOverridden < ::
|
7
|
+
class CastIsNotOverridden < ::ConvenientService::Error
|
8
8
|
def initialize(klass:)
|
9
9
|
message = <<~TEXT
|
10
10
|
Cast method (.cast) of `#{klass}` is NOT overridden.
|
@@ -14,7 +14,7 @@ module ConvenientService
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
class FailedToCast < ::
|
17
|
+
class FailedToCast < ::ConvenientService::Error
|
18
18
|
def initialize(other:, klass:)
|
19
19
|
message = <<~TEXT
|
20
20
|
Failed to cast `#{other.inspect}` into `#{klass}`.
|
@@ -0,0 +1,212 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Support
|
5
|
+
##
|
6
|
+
# @internal
|
7
|
+
# NOTE: `return` exits from the enclosing method. `break` from the iterator method. `next` from the block.
|
8
|
+
# - https://github.com/ruby/spec/blob/master/language/return_spec.rb
|
9
|
+
# - https://github.com/ruby/spec/blob/master/language/break_spec.rb
|
10
|
+
# - https://github.com/ruby/spec/blob/master/language/next_spec.rb
|
11
|
+
# - https://stackoverflow.com/a/1402764/12201472
|
12
|
+
#
|
13
|
+
class Counter
|
14
|
+
module Errors
|
15
|
+
class ValueAfterIncrementIsGreaterThanMaxValue < ::ConvenientService::Error
|
16
|
+
##
|
17
|
+
# @param n [Integer]
|
18
|
+
# @param current_value [Integer]
|
19
|
+
# @param max_value [Integer]
|
20
|
+
# @return [void]
|
21
|
+
#
|
22
|
+
def initialize(n:, current_value:, max_value:)
|
23
|
+
message = <<~TEXT
|
24
|
+
Value after increment by `#{n}` is greater than the max value.
|
25
|
+
|
26
|
+
Current value is `#{current_value}`.
|
27
|
+
|
28
|
+
Max value is `#{max_value}`.
|
29
|
+
TEXT
|
30
|
+
|
31
|
+
super(message)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class ValueAfterDecrementIsLowerThanMinValue < ::ConvenientService::Error
|
36
|
+
##
|
37
|
+
# @param n [Integer]
|
38
|
+
# @param current_value [Integer]
|
39
|
+
# @param min_value [Integer]
|
40
|
+
# @return [void]
|
41
|
+
#
|
42
|
+
def initialize(n:, current_value:, min_value:)
|
43
|
+
message = <<~TEXT
|
44
|
+
Value after decrement by `#{n}` is lower than the min value.
|
45
|
+
|
46
|
+
Current value is `#{current_value}`.
|
47
|
+
|
48
|
+
Min value is `#{min_value}`.
|
49
|
+
TEXT
|
50
|
+
|
51
|
+
super(message)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
##
|
57
|
+
# @!attribute [r] initial_value
|
58
|
+
# @return [Integer]
|
59
|
+
#
|
60
|
+
attr_reader :initial_value
|
61
|
+
|
62
|
+
##
|
63
|
+
# @!attribute [rw] current_value
|
64
|
+
# @return [Integer]
|
65
|
+
#
|
66
|
+
attr_accessor :current_value
|
67
|
+
|
68
|
+
##
|
69
|
+
# @!attribute [r] min_value
|
70
|
+
# @return [Integer, Float::INFINITY]
|
71
|
+
#
|
72
|
+
attr_reader :min_value
|
73
|
+
|
74
|
+
##
|
75
|
+
# @!attribute [r] max_value
|
76
|
+
# @return [Integer, Float::INFINITY]
|
77
|
+
#
|
78
|
+
attr_reader :max_value
|
79
|
+
|
80
|
+
##
|
81
|
+
# @param initial_value [Integer]
|
82
|
+
# @param min_value [Integer, -::Float::Infinity]
|
83
|
+
# @param max_value [Integer, Float::Infinity]
|
84
|
+
# @return [void]
|
85
|
+
#
|
86
|
+
# @note Do NOT rely on the fact that `min_value` and `max_value` are almost always `Integer` instances since they are set to `-Float::INFINITY` and `Float::INFINITY` by default.
|
87
|
+
# @note `Float::INFINITY` and `Integer` are just contextual ducks, NOT full ducks. For example, `Float::INFINITY.to_i` raises `FloatDomainError`.
|
88
|
+
#
|
89
|
+
def initialize(initial_value: 0, min_value: -::Float::INFINITY, max_value: ::Float::INFINITY)
|
90
|
+
@initial_value = initial_value
|
91
|
+
@current_value = initial_value
|
92
|
+
@min_value = min_value
|
93
|
+
@max_value = max_value
|
94
|
+
@lock = ::Mutex.new
|
95
|
+
end
|
96
|
+
|
97
|
+
##
|
98
|
+
# @param n [Integer]
|
99
|
+
# @return [Integer]
|
100
|
+
#
|
101
|
+
# @internal
|
102
|
+
# NOTE: Instance variables are accessed directly to release the lock faster.
|
103
|
+
#
|
104
|
+
# NOTE: The name is inspired by Redis and Concurrent Ruby.
|
105
|
+
# - https://redis.io/commands/incr/
|
106
|
+
# - https://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/AtomicFixnum.html#increment-instance_method
|
107
|
+
#
|
108
|
+
def increment(n = 1)
|
109
|
+
return @current_value if @current_value + n > @max_value
|
110
|
+
|
111
|
+
@current_value += n
|
112
|
+
end
|
113
|
+
|
114
|
+
##
|
115
|
+
# @param n [Integer]
|
116
|
+
# @return [Integer]
|
117
|
+
# @raise [ConvenientService::Support::ThreadSafeCounter::Errors::ValueAfterIncrementIsGreaterThanMaxValue]
|
118
|
+
#
|
119
|
+
# @internal
|
120
|
+
# NOTE: Instance variables are accessed directly to release the lock faster.
|
121
|
+
#
|
122
|
+
# NOTE: The name is inspired by Rails.
|
123
|
+
# - https://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-save
|
124
|
+
# - https://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-save-21
|
125
|
+
#
|
126
|
+
def increment!(n = 1)
|
127
|
+
raise Errors::ValueAfterIncrementIsGreaterThanMaxValue.new(n: n, current_value: @current_value, max_value: @max_value) if @current_value + n > @max_value
|
128
|
+
|
129
|
+
@current_value += n
|
130
|
+
end
|
131
|
+
|
132
|
+
##
|
133
|
+
# `bincrement` means boolean increment. Works exactly in the same way as `increment` except returns a boolean value.
|
134
|
+
# If incremented successfully then returns `true`, otherwise - returns `false`.
|
135
|
+
#
|
136
|
+
# @param n [Integer]
|
137
|
+
# @return [Boolean]
|
138
|
+
#
|
139
|
+
# @internal
|
140
|
+
# NOTE: Instance variables are accessed directly to release the lock faster.
|
141
|
+
#
|
142
|
+
def bincrement(n = 1)
|
143
|
+
return false if @current_value + n > @max_value
|
144
|
+
|
145
|
+
@current_value += n
|
146
|
+
|
147
|
+
true
|
148
|
+
end
|
149
|
+
|
150
|
+
##
|
151
|
+
# @param n [Integer]
|
152
|
+
# @return [Integer]
|
153
|
+
#
|
154
|
+
# @internal
|
155
|
+
# NOTE: Instance variables are accessed directly to release the lock faster.
|
156
|
+
#
|
157
|
+
# NOTE: The name is inspired by Redis and Concurrent Ruby.
|
158
|
+
# - https://redis.io/commands/decr/
|
159
|
+
# - https://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/AtomicFixnum.html#decrement-instance_method
|
160
|
+
#
|
161
|
+
def decrement(n = 1)
|
162
|
+
return @current_value if @current_value - n < @min_value
|
163
|
+
|
164
|
+
@current_value -= n
|
165
|
+
end
|
166
|
+
|
167
|
+
##
|
168
|
+
# @param n [Integer]
|
169
|
+
# @return [Integer]
|
170
|
+
# @raise [ConvenientService::Support::ThreadSafeCounter::Errors::ValueAfterDecrementIsLowerThanMinValue]
|
171
|
+
#
|
172
|
+
# @internal
|
173
|
+
# NOTE: Instance variables are accessed directly to release the lock faster.
|
174
|
+
#
|
175
|
+
# NOTE: The name is inspired by Rails.
|
176
|
+
# - https://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-save
|
177
|
+
# - https://api.rubyonrails.org/classes/ActiveRecord/Persistence.html#method-i-save-21
|
178
|
+
#
|
179
|
+
def decrement!(n = 1)
|
180
|
+
raise Errors::ValueAfterDecrementIsLowerThanMinValue.new(n: n, current_value: @current_value, min_value: @min_value) if @current_value - n < @min_value
|
181
|
+
|
182
|
+
@current_value -= n
|
183
|
+
end
|
184
|
+
|
185
|
+
##
|
186
|
+
# `bdecrement` means boolean decrement. Works exactly in the same way as `decrement` except returns a boolean value.
|
187
|
+
# If decremented successfully then returns `true`, otherwise - returns `false`.
|
188
|
+
#
|
189
|
+
# @param n [Integer]
|
190
|
+
# @return [Boolean]
|
191
|
+
#
|
192
|
+
# @internal
|
193
|
+
# NOTE: Instance variables are accessed directly to release the lock faster.
|
194
|
+
#
|
195
|
+
def bdecrement(n = 1)
|
196
|
+
return false if @current_value - n < @min_value
|
197
|
+
|
198
|
+
@current_value -= n
|
199
|
+
|
200
|
+
true
|
201
|
+
end
|
202
|
+
|
203
|
+
##
|
204
|
+
# @internal
|
205
|
+
# NOTE: Instance variables are accessed directly to release the lock faster.
|
206
|
+
#
|
207
|
+
def reset
|
208
|
+
@current_value = @initial_value
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ConvenientService
|
4
|
+
module Support
|
5
|
+
module DependencyContainer
|
6
|
+
module Commands
|
7
|
+
class AssertValidContainer < Support::Command
|
8
|
+
##
|
9
|
+
# @!attribute [r] container
|
10
|
+
# @return [Module]
|
11
|
+
#
|
12
|
+
attr_reader :container
|
13
|
+
|
14
|
+
##
|
15
|
+
# @param container [Module]
|
16
|
+
# @return [void]
|
17
|
+
#
|
18
|
+
def initialize(container:)
|
19
|
+
@container = container
|
20
|
+
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# @return [void]
|
24
|
+
# @raise [ConvenientService::Support::DependencyContainer::Errors::NotExportableModule]
|
25
|
+
#
|
26
|
+
def call
|
27
|
+
raise Errors::NotExportableModule.new(mod: container) unless Utils::Module.include_module?(container, DependencyContainer::Export)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|