Class: Hanami::Slice Private
- Inherits:
-
Object
- Object
- Hanami::Slice
- Defined in:
- lib/hanami/slice.rb,
lib/hanami/slice/router.rb,
lib/hanami/slice/routes_helper.rb,
lib/hanami/slice/routing/resolver.rb,
lib/hanami/slice/view_name_inferrer.rb,
lib/hanami/slice/routing/middleware/stack.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A slice represents any distinct area of concern within an Hanami app.
For smaller apps, a slice may encompass the whole app itself (see 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.
Direct Known Subclasses
Defined Under Namespace
Modules: ClassMethods, Routing Classes: Router, RoutesHelper, ViewNameInferrer
Class Method Summary collapse
- .inherited(subclass) ⇒ Object private
Class Method Details
.inherited(subclass) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# 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 |