Class: Decidim::EngineResolver
- Inherits:
-
Object
- Object
- Decidim::EngineResolver
- Defined in:
- app/services/decidim/engine_resolver.rb
Overview
This class can be used to resolve the mounted route based on the current routes in any provided context.
Instance Method Summary collapse
-
#initialize(current_routes) ⇒ EngineResolver
constructor
Initializes the engine resolver instance.
-
#mounted_name ⇒ String
Resolves the mounted route name for the provided context.
Constructor Details
#initialize(current_routes) ⇒ EngineResolver
Initializes the engine resolver instance.
11 12 13 |
# File 'app/services/decidim/engine_resolver.rb', line 11 def initialize(current_routes) @current_routes = current_routes end |
Instance Method Details
#mounted_name ⇒ String
Resolves the mounted route name for the provided context.
19 20 21 22 23 24 |
# File 'app/services/decidim/engine_resolver.rb', line 19 def mounted_name return "main_app" if base_engine.routes == current_routes route = find_mounted_route(base_engine) route&.name || "decidim" end |