Method: Hanami::Slice::ClassMethods#boot

Defined in:
lib/hanami/slice.rb

#bootself

Boots the slice.

This will prepare the slice (if not already prepared), start each of its providers, register all the slice’s components from its Ruby source files, and import components from any other slices. It will also boot any of the slice’s own registered nested slices. It will then freeze its container so no further components can be registered.

Call boot if you want to fully load a slice and incur all load time up front, such as when preparing an app to serve web requests. Booting slices is the approach taken when running Hanami’s standard Puma setup (see config.ru).

Returns:

  • (self)

See Also:

Since:

  • 2.0.0



337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/hanami/slice.rb', line 337

def boot
  return self if booted?

  prepare

  container.finalize!
  slices.each(&:boot)

  @booted = true

  self
end