23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/convenient_service/support/dependency_container/import.rb', line 23
def import(slug, from:, as: Support::NOT_PASSED, scope: Constants::DEFAULT_SCOPE, prepend: Constants::DEFAULT_PREPEND)
Commands::AssertValidScope.call(scope: scope)
Commands::AssertValidContainer.call(container: from)
Commands::AssertValidMethod.call(slug: slug, scope: scope, container: from)
method = from.exported_methods.find_by(slug: slug, scope: scope)
method = method.copy(overrides: {kwargs: {alias_slug: as}}) unless Support::NOT_PASSED[as]
Commands::ImportMethod.call(importing_module: self, exported_method: method, prepend: prepend)
end
|