struct
Amber::Router::ParamConstraints::Slug
- Amber::Router::ParamConstraints::Slug
- Struct
- Value
- Object
Overview
Matches a lowercase slug: runs of a-z and 0-9 joined by single
hyphens, such as my-post-123. A slug never starts or ends with a hyphen
and never has two in a row.
Included Modules
Defined in:
amber/router/param_constraints/slug.crConstructors
Instance Method Summary
- #initialize
-
#matches?(segment : String) : Bool
Returns
truewhen segment satisfies this rule. -
#matches_span?(path : String, byte_offset : Int32, bytesize : Int32) : Bool
Returns
truewhen the segment of path that starts at byte_offset and is bytesize bytes long satisfies this rule. -
#to_s(io : IO) : Nil
Writes the short label that route listings and
Route#to_jsonshow for this rule.
Instance methods inherited from module Amber::Router::ParamConstraint
matches?(segment : String) : Bool
matches?,
matches_span?(path : String, byte_offset : Int32, bytesize : Int32) : Bool
matches_span?,
to_s(io : IO) : Nil
to_s
Constructor Detail
Instance Method Detail
Returns true when segment satisfies this rule.
Returns true when the segment of path that starts at byte_offset
and is bytesize bytes long satisfies this rule. The router calls this
while it walks a path; the built-in rules override it to read the bytes
in place instead of copying the segment.
Writes the short label that route listings and Route#to_json show for
this rule.