Sha256: 6a589b2b8b29f7f8cc2e870d25effbf498b7e900c79b2dc030fcd910d8a2ed68
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module Hanami # App routes # # Users are expected to inherit from this class to define their app # routes. # # @example # # config/routes.rb # # frozen_string_literal: true # # require "hanami/routes" # # module MyApp # class Routes < Hanami::Routes # define do # root to: "home.show" # end # end # end # # See {Hanami::Slice::Router} for the syntax allowed within the # `define` block. # # @see Hanami::Slice::Router # @since 2.0.0 class Routes # Defines app routes # # @yield DSL syntax to define app routes executed in the context # of {Hanami::Slice::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
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hanami-2.0.0.beta2 | lib/hanami/routes.rb |
hanami-2.0.0.beta1.1 | lib/hanami/routes.rb |
hanami-2.0.0.beta1 | lib/hanami/routes.rb |