Sha256: 54ea4b73fc3b7a3a823587254d1000d49468e1231242d934ebe41788311ce85e
Contents?: true
Size: 1.3 KB
Versions: 6
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal: true module Hanami class Application # Application routes # # Users are expected to inherit from this class to define their application # routes. # # @example # # config/routes.rb # # frozen_string_literal: true # # require "hanami/application/routes" # # module MyApp # class Routes < Hanami::Application::Routes # define do # slice :main, at: "/" do # root to: "home.show" # end # end # end # end # # See {Hanami::Application::Router} for the syntax allowed within the # `define` block. # # @see Hanami::Application::Router # @since 2.0.0 class Routes # Defines application routes # # @yield DSL syntax to define application routes executed in the context # of {Hanami::Application::Router} # # @return [Proc] def self.define(&block) @_routes = block end # @api private def self.routes @_routes || raise(<<~MSG) Routes need to be defined before being able to fetch them. E.g., define do slice :main, at: "/" do root to: "home.show" end end MSG end end end end
Version data entries
6 entries across 6 versions & 1 rubygems