Class: ActionDispatch::Router::Route
- Defined in:
- runtime/action_dispatch/router.rb,
runtime/action_dispatch/router.rbs
Overview
One entry in the route table: a typed class so each per-field type is
statically known. verb rather than method, which Ruby's Object
already answers.
controller holds the class, not a symbol: the dispatcher calls
matched.controller.new, and a symbol would need a second mapping back to
the class that drifts from the table.
Positional initialize: keywords do not convert symmetrically between
definition and call site, and this is an internal class.
Instance Attribute Summary collapse
- #action ⇒ Symbol readonly
- #controller ⇒ Class readonly
- #int_params ⇒ String readonly
- #pattern ⇒ String readonly
- #pattern_parts ⇒ Array[String] readonly
- #req_format ⇒ Symbol? readonly
- #verb ⇒ String readonly
Instance Method Summary collapse
-
#initialize(verb, pattern, controller, action, req_format = nil, int_params = +"")) ⇒ Route
constructor
the route-forced response format (a route declared
get "/rss" => "home#index", :format => "rss"), nil for the common infer-from-path case.
Constructor Details
#initialize(verb, pattern, controller, action, req_format = nil, int_params = +"")) ⇒ Route
the route-forced response format (a route declared
get "/rss" => "home#index", :format => "rss"), nil for the common
infer-from-path case. Named req_format (not format) so targets whose
stdlibs claim format never collide.
int_params — space-joined names of path params constrained to
digit-only segments (Roda's Integer matcher, a constraints:
digit class), e.g. "id" or "article_id id"; the empty
string for the unconstrained common case. A candidate segment
that isn't all digits makes the route a non-match, so
/articles/12abc falls through to 404 instead of binding
id = "12abc".
42 |
# File 'runtime/action_dispatch/router.rb', line 42
def initialize: (String verb, String pattern, Class controller, Symbol action, ?Symbol? req_format, ?String int_params) -> void
|
Instance Attribute Details
#action ⇒ Symbol (readonly)
7 |
# File 'runtime/action_dispatch/router.rbs', line 7
def action: () -> Symbol
|
#controller ⇒ Class (readonly)
6 |
# File 'runtime/action_dispatch/router.rbs', line 6
def controller: () -> Class
|
#int_params ⇒ String (readonly)
9 |
# File 'runtime/action_dispatch/router.rbs', line 9
def int_params: () -> String
|
#pattern ⇒ String (readonly)
5 |
# File 'runtime/action_dispatch/router.rbs', line 5
def pattern: () -> String
|
#pattern_parts ⇒ Array[String] (readonly)
10 |
# File 'runtime/action_dispatch/router.rbs', line 10
def pattern_parts: () -> Array[String]
|
#req_format ⇒ Symbol? (readonly)
8 |
# File 'runtime/action_dispatch/router.rbs', line 8
def req_format: () -> Symbol?
|
#verb ⇒ String (readonly)
4 |
# File 'runtime/action_dispatch/router.rbs', line 4
def verb: () -> String
|