Module: Injectable::Registerable

Included in:
Container, Registry
Defined in:
lib/injectable/registerable.rb

Overview

Since:

  • 0.0.0

Instance Method Summary collapse

Instance Method Details

#register_implementation(name, *classes) ⇒ Object

Register that instances of klass will perform the given role in this container context.

Examples:

Register that the user_finder role will be performed by

instances of DatabaseUserFinder
container.register_implementation(:user_finder, DatabaseUserFinder)

Parameters:

  • name (Symbol)

    The name of the role.

  • classes (*Class)

    The names of the classes performing this role.

Since:

  • 0.0.1



16
17
18
# File 'lib/injectable/registerable.rb', line 16

def register_implementation(name, *classes)
  implementations[name] = classes.flatten
end