Sha256: 03a4e0f718a1b654ad85e230f84445519fd3802a1a36cf711a50ca493e6b25b6

Contents?: true

Size: 817 Bytes

Versions: 1

Compression:

Stored size: 817 Bytes

Contents

# frozen_string_literal: true

module Hanami
  # @api private
  module Providers
    # Provider source to register routes helper component in Hanami slices.
    #
    # @see Hanami::Slice::RoutesHelper
    #
    # @api private
    # @since 2.0.0
    class Routes < Dry::System::Provider::Source
      # @api private
      def prepare
        require "hanami/slice/routes_helper"
      end

      # @api private
      def start
        # Register a lazy instance of RoutesHelper to ensure we don't load prematurely load the
        # router during the process of booting. This ensures the router's resolver can run strict
        # action key checks once when it runs on a fully booted slice.
        register :routes do
          Hanami::Slice::RoutesHelper.new(target.router)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hanami-2.2.0.beta1 lib/hanami/providers/routes.rb