Sha256: 1d3954544b292c8586338ec6f0e187c6576be8f936aa85cfe62a5ea2dd31fda3

Contents?: true

Size: 811 Bytes

Versions: 4

Compression:

Stored size: 811 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 < Hanami::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(slice.router)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hanami-2.2.1 lib/hanami/providers/routes.rb
hanami-2.2.0 lib/hanami/providers/routes.rb
hanami-2.2.0.rc1 lib/hanami/providers/routes.rb
hanami-2.2.0.beta2 lib/hanami/providers/routes.rb