Module <
In: merb-slices/lib/generators/templates/very_thin/lib/%base_name%.rb
merb-slices/lib/generators/templates/common/application.rb
merb-slices/lib/generators/templates/thin/stubs/application.rb

All Slice code is expected to be namespaced inside a module

Methods

Public Class methods

Activation hook - runs after AfterAppLoads BootLoader

[Source]

    # File merb-slices/lib/generators/templates/very_thin/lib/%base_name%.rb, line 32
32:     def self.activate
33:     end

Deactivation hook - triggered by Merb::Slices.deactivate(<%= module_name %>)

[Source]

    # File merb-slices/lib/generators/templates/very_thin/lib/%base_name%.rb, line 36
36:     def self.deactivate
37:     end

Initialization hook - runs before AfterAppLoads BootLoader

[Source]

    # File merb-slices/lib/generators/templates/very_thin/lib/%base_name%.rb, line 28
28:     def self.init
29:     end

Stub classes loaded hook - runs before LoadClasses BootLoader right after a slice‘s classes have been loaded internally.

[Source]

    # File merb-slices/lib/generators/templates/very_thin/lib/%base_name%.rb, line 24
24:     def self.loaded
25:     end

This sets up a very thin slice‘s structure.

[Source]

    # File merb-slices/lib/generators/templates/very_thin/lib/%base_name%.rb, line 54
54:     def self.setup_default_structure!
55:       self.push_app_path(:root, Merb.root / 'slices' / self.identifier, nil)
56:       
57:       self.push_path(:stub, root_path('stubs'), nil)
58:       self.push_app_path(:stub, app_dir_for(:root), nil)
59:       
60:       self.push_path(:application, root, 'application.rb')
61:       self.push_app_path(:application, app_dir_for(:root), 'application.rb')
62:             
63:       self.push_path(:public, root_path('public'), nil)
64:       self.push_app_path(:public, Merb.root / 'public' / 'slices' / self.identifier, nil)
65:       
66:       public_components.each do |component|
67:         self.push_path(component, dir_for(:public) / "#{component}s", nil)
68:         self.push_app_path(component, app_dir_for(:public) / "#{component}s", nil)
69:       end
70:     end

Setup routes inside the host application

@param scope<Merb::Router::Behaviour>

 Routes will be added within this scope (namespace). In fact, any
 router behaviour is a valid namespace, so you can attach
 routes at any level of your router setup.

@note prefix your named routes with :<%= symbol_name %>_

  to avoid potential conflicts with global named routes.

[Source]

    # File merb-slices/lib/generators/templates/very_thin/lib/%base_name%.rb, line 48
48:     def self.setup_router(scope)
49:       # enable slice-level default routes by default
50:       scope.default_routes
51:     end

[Validate]