struct
Amber::Router::ParamConstraints::OneOf
- Amber::Router::ParamConstraints::OneOf
- Struct
- Value
- Object
Overview
Matches a segment equal to one of the listed values.
get "/posts/:state", PostsController, :index,
{"state" => Amber::Router::ParamConstraints::OneOf.new("draft", "published")}
Included Modules
Defined in:
amber/router/param_constraints/one_of.crConstructors
Instance Method Summary
-
#list_of_values : Array(String)
The values this rule accepts, in the order given.
-
#matches?(segment : String) : Bool
Returns
truewhen segment 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
The values this rule accepts, in the order given. A copy: changing it does not change the rule.
Description copied from module Amber::Router::ParamConstraint
Returns true when segment satisfies this rule.
def to_s(io : IO) : Nil
#
Description copied from module Amber::Router::ParamConstraint
Writes the short label that route listings and Route#to_json show for
this rule.