Class: ConvenientService::Support::DependencyContainer::Commands::ImportMethod

Inherits:
Command
  • Object
show all
Includes:
ConvenientService::Support::Delegate
Defined in:
lib/convenient_service/support/dependency_container/commands/import_method.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ConvenientService::Support::Delegate::ClassMethodsForForwardable

#delegate

Methods inherited from Command

[], call

Constructor Details

#initialize(importing_module:, exported_method:, prepend:) ⇒ ImportMethod

Returns a new instance of ImportMethod.

Parameters:

  • importing_module (Module)
  • exported_method (ConvenientService::Support::DependencyContainer::Method)
  • prepend (Boolean)


44
45
46
47
48
# File 'lib/convenient_service/support/dependency_container/commands/import_method.rb', line 44

def initialize(importing_module:, exported_method:, prepend:)
  @importing_module = importing_module
  @exported_method = exported_method
  @prepend = prepend
end

Instance Attribute Details

#exported_methodObject (readonly)

Returns the value of attribute exported_method.



25
26
27
# File 'lib/convenient_service/support/dependency_container/commands/import_method.rb', line 25

def exported_method
  @exported_method
end

#importing_moduleObject (readonly)

Returns the value of attribute importing_module.



19
20
21
# File 'lib/convenient_service/support/dependency_container/commands/import_method.rb', line 19

def importing_module
  @importing_module
end

#prependObject (readonly)

Returns the value of attribute prepend.



31
32
33
# File 'lib/convenient_service/support/dependency_container/commands/import_method.rb', line 31

def prepend
  @prepend
end

#scopeSymbol (readonly)

Returns:

  • (Symbol)


37
# File 'lib/convenient_service/support/dependency_container/commands/import_method.rb', line 37

delegate :scope, to: :exported_method

Instance Method Details

#callConvenientService::Support::DependencyContainer::Method

Returns:

  • (ConvenientService::Support::DependencyContainer::Method)


53
54
55
56
57
# File 'lib/convenient_service/support/dependency_container/commands/import_method.rb', line 53

def call
  import imported_scoped_methods

  exported_method.define_in_module!(imported_scoped_methods)
end