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)


39
40
41
42
43
# File 'lib/convenient_service/support/dependency_container/commands/import_method.rb', line 39

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.



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

def exported_method
  @exported_method
end

#importing_moduleObject (readonly)

Returns the value of attribute importing_module.



14
15
16
# File 'lib/convenient_service/support/dependency_container/commands/import_method.rb', line 14

def importing_module
  @importing_module
end

#prependObject (readonly)

Returns the value of attribute prepend.



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

def prepend
  @prepend
end

#scopeSymbol (readonly)

Returns:

  • (Symbol)


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

delegate :scope, to: :exported_method

Instance Method Details

#callConvenientService::Support::DependencyContainer::Method

Returns:

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


48
49
50
51
52
# File 'lib/convenient_service/support/dependency_container/commands/import_method.rb', line 48

def call
  import imported_scoped_methods

  exported_method.define_in_module!(imported_scoped_methods)
end