Class: Hanami::Slice

Inherits:
Object show all
Defined in:
gems/gems/hanami-2.1.0/lib/hanami/slice.rb,
gems/gems/hanami-2.1.0/lib/hanami/slice/router.rb,
gems/gems/hanami-2.1.0/lib/hanami/slice/routes_helper.rb,
gems/gems/hanami-2.1.0/lib/hanami/slice/routing/resolver.rb,
gems/gems/hanami-2.1.0/lib/hanami/slice/view_name_inferrer.rb,
gems/gems/hanami-2.1.0/lib/hanami/slice/routing/middleware/stack.rb

Overview

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.

Since:

  • 2.0.0

Defined Under Namespace

Modules: ClassMethods Classes: RoutesHelper