Exception: ConvenientService::Service::Plugins::ForbidsConvenientServiceEntitiesAsConstructorArguments::Exceptions::CodePassedAsConstructorArgument

Inherits:
Exception
  • Object
show all
Defined in:
lib/convenient_service/service/plugins/forbids_convenient_service_entities_as_constructor_arguments/exceptions.rb

Instance Method Summary collapse

Methods inherited from Exception

new

Instance Method Details

#initialize_with_kwargs(selector:, service:, code:) ⇒ Object



84
85
86
87
88
89
90
91
92
93
94
# File 'lib/convenient_service/service/plugins/forbids_convenient_service_entities_as_constructor_arguments/exceptions.rb', line 84

def initialize_with_kwargs(selector:, service:, code:)
  message = <<~TEXT
    Code of `#{Utils::Class.display_name(code.result.service.class)}` result is passed as constructor argument `#{selector}` to `#{Utils::Class.display_name(service.class)}`.

    It is an antipattern. It neglects the idea of steps.

    Please, convert it to symbol or try to reorganize `#{Utils::Class.display_name(service.class)}` service.
  TEXT

  initialize(message)
end