struct Amber::Router::ParamConstraints::OneOf

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.cr

Constructors

Instance Method Summary

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

def self.new(*values : String) #

[View source]

Instance Method Detail

def list_of_values : Array(String) #

The values this rule accepts, in the order given. A copy: changing it does not change the rule.


[View source]
def matches?(segment : String) : Bool #
Description copied from module Amber::Router::ParamConstraint

Returns true when segment satisfies this rule.


[View source]
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.


[View source]