Method: Hanami::Slice::ClassMethods#prepare

Defined in:
lib/hanami/slice.rb

#prepareself #prepare(provider_name) ⇒ self

Overloads:

  • #prepareself

    Prepares the slice.

    This will define the slice’s Slice and Deps constants, make all Ruby source files inside the slice’s root dir autoloadable, as well as lazily loadable as container components.

    Call prepare when you want to access particular components within the slice while still minimizing load time. Preparing slices is the approach taken when loading the Hanami console or when running tests.

    Returns:

    • (self)

    See Also:

    Since:

    • 2.0.0

  • #prepare(provider_name) ⇒ self

    Prepares a provider.

    This triggers the provider’s prepare lifecycle step.

    Parameters:

    • provider_name (Symbol)

      the name of the provider to start

    Returns:

    • (self)

    Since:

    • 2.0.0

Since:

  • 2.0.0



282
283
284
285
286
287
288
289
290
# File 'lib/hanami/slice.rb', line 282

def prepare(provider_name = nil)
  if provider_name
    container.prepare(provider_name)
  else
    prepare_slice
  end

  self
end