Sha256: d734ba47b85a6a5ad3f00d05190d91146644994d6bb4c69de0e6cdd3c049c2c5
Contents?: true
Size: 1.71 KB
Versions: 2
Compression:
Stored size: 1.71 KB
Contents
require 'hanami/routes' require 'hanami/routing/default' module Hanami # @since 0.9.0 # @api private module Components # @since 0.9.0 # @api private module App # hanami-router configuration for a single Hanami application in the project. # # @since 0.9.0 # @api private class Routes # Configure hanami-router for a single Hanami application in the project. # # @param app [Hanami::Configuration::App] a Hanami application # # @since 0.9.0 # @api private 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 # @since 0.9.0 # @api private 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 options = { resolver: resolver, default_app: default_app, scheme: config.scheme, host: config.host, port: config.port, prefix: config.path_prefix, force_ssl: config.force_ssl } options[:parsers] = config.body_parsers if config.body_parsers.any? Hanami::Router.new(options, &config.routes) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hanami-1.3.5 | lib/hanami/components/app/routes.rb |
hanami-1.3.4 | lib/hanami/components/app/routes.rb |