class Hanami::Slice
A slice represents any distinct area of concern within an Hanami
app.
For smaller apps, a slice may encompass the whole app itself (see {Hanami::App}), whereas larger apps may consist of many slices.
Each slice corresponds a single module namespace and a single root directory of source files for loading as components into its container.
Each slice has its own config, and may optionally have its own settings, routes, as well as other nested slices.
Slices expect an Hanami
app to be defined (which itself is a slice). They will initialize their config as a copy of the app’s, and will also configure certain components
Slices must be prepared and optionally booted before they can be used (see {ClassMethods.prepare} and {ClassMethods.boot}). A prepared slice will lazily load its components and nested slices (useful for minimising initial load time), whereas a booted slice will eagerly load all its components and nested slices, then freeze its container.
@since 2.0.0
Public Class Methods
@api private
# File lib/hanami/slice.rb, line 35 def self.inherited(subclass) super subclass.extend(ClassMethods) @_mutex.synchronize do subclass.class_eval do @_mutex = Mutex.new @autoloader = Zeitwerk::Loader.new @container = Class.new(Dry::System::Container) end end end