struct LuckerRouter::PathReader

Overview

A PathReader parses a URI path into segments.

It can be used to read a String representing a full path into the individual segments it contains.

path = "/foo/bar/baz"
PathReader.new(path).to_a => ["", "foo", "bar", "baz"]

Percent-encoded characters are automatically decoded following segmentation

path = "/user/foo%40example.com/details"
PathReader.new(path).to_a => ["", "user", "foo@example.com", "details"]

Included Modules

Defined in:

lucky_router/path_reader.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(path : String) #

[View source]

Class Method Detail

def self.decode_range(path : String, offset : Int32, length : Int32) : String #

Decode directly from the source bytes into one bounded string allocation. Like URI.decode, invalid escapes and literal '+' characters are preserved.


[View source]

Instance Method Detail

def each(&) #
Description copied from module Enumerable(String)

Must yield this collection's elements to the block.


[View source]