struct LuckyRouter::PathPart

Overview

A PathPart represents a single section of a path

It can be a static path

path_part = PathPart.new("users")
path_part.path_variable? => false
path_part.optional? => false
path_part.name => "users"

It can be a path variable

path_part = PathPart.new(":id")
path_part.path_variable? => true
path_part.optional? => false
path_part.name => "id"

It can be optional

path_part = PathPart.new("?users")
path_part.path_variable? => false
path_part.optional? => true
path_part.name => "users"

Defined in:

lucky_router/path_part.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(part : String) #

[View source]

Class Method Detail

def self.split_path(path : String) : Array(PathPart) #

[View source]

Instance Method Detail

def glob? : Bool #

[View source]
def name : String #

[View source]
def optional? : Bool #

[View source]
def part : String #

[View source]
def path_variable? : Bool #

[View source]
def validate! #

[View source]