Class: Hanami::Components::App::Routes Private
- Inherits:
-
Object
- Object
- Hanami::Components::App::Routes
- Defined in:
- lib/hanami/components/app/routes.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.
hanami-router configuration for a sigle Hanami application in the project.
Class Method Summary collapse
-
.application_routes(app) ⇒ Object
private
rubocop:disable Metrics/MethodLength.
-
.resolve(app) ⇒ Object
private
Configure hanami-router for a single Hanami application in the project.
Class Method Details
.application_routes(app) ⇒ 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.
rubocop:disable Metrics/MethodLength
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/hanami/components/app/routes.rb', line 29 def self.application_routes(app) # rubocop:disable Metrics/MethodLength config = app.configuration namespace = app.namespace resolver = Hanami::Routing::EndpointResolver.new(pattern: config.controller_pattern, namespace: namespace) default_app = Hanami::Routing::Default.new Hanami::Router.new( resolver: resolver, default_app: default_app, parsers: config.body_parsers, scheme: config.scheme, host: config.host, port: config.port, prefix: config.path_prefix, force_ssl: config.force_ssl, &config.routes ) end |
.resolve(app) ⇒ 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.
Configure hanami-router for a single Hanami application in the project.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/hanami/components/app/routes.rb', line 18 def self.resolve(app) namespace = app.namespace routes = application_routes(app) if namespace.routes.nil? # rubocop:disable Style/IfUnlessModifier namespace.routes = Hanami::Routes.new(routes) end Components.resolved("#{app.app_name}.routes", routes) end |