Sha256: b45c5bd99ec943be98580d8536fe45d5b68b1b95bab2aca7310a2b38716a8dfd

Contents?: true

Size: 888 Bytes

Versions: 6

Compression:

Stored size: 888 Bytes

Contents

# frozen_string_literal: true

module Hanami
  class Application
    # Hanami application routes helpers
    #
    # An instance of this class gets registered in the container
    # (`routes_helper` key) once the Hanami application is booted. You can use
    # it to get the route helpers for your application.
    #
    # @example
    #   MyApp::Application["routes_helper"].path(:root) # => "/"
    #
    # @see Hanami::Router::UrlHelpers
    # @since 2.0.0
    class RoutesHelper
      # @since 2.0.0
      # @api private
      def initialize(router)
        @router = router
      end

      # @see Hanami::Router::UrlHelpers#path
      def path(*args, **kwargs, &block)
        @router.path(*args, **kwargs, &block)
      end

      # @see Hanami::Router::UrlHelpers#url
      def url(*args, **kwargs, &block)
        @router.url(*args, **kwargs, &block)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hanami-2.0.0.alpha8 lib/hanami/application/routes_helper.rb
hanami-2.0.0.alpha7.1 lib/hanami/application/routes_helper.rb
hanami-2.0.0.alpha7 lib/hanami/application/routes_helper.rb
hanami-2.0.0.alpha6 lib/hanami/application/routes_helper.rb
hanami-2.0.0.alpha5 lib/hanami/application/routes_helper.rb
hanami-2.0.0.alpha4 lib/hanami/application/routes_helper.rb