struct LuckyRouter::CompiledParams

Overview

Read-only path parameters from a compiled match, in the same iteration order as a live match's hash. Use #to_h to obtain an independently mutable copy.

Included Modules

Defined in:

lucky_router/compiled_params.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def ==(other : CompiledParams | Hash) : Bool #

[View source]
def [](name) : String #

[View source]
def []?(name) : String | Nil #

[View source]
def each(& : Pair -> ) : Nil #
Description copied from module Enumerable({String, String})

Must yield this collection's elements to the block.


[View source]
def empty? : Bool #
Description copied from module Enumerable({String, String})

Returns true if self does not contain any element.

([] of Int32).empty? # => true
([1]).empty?         # => false
[nil, false].empty?  # => false
  • #present? returns the inverse.

[View source]
def fetch(name, default) #

[View source]
def fetch(name, &) #

[View source]
def has_key?(name) : Bool #

[View source]
def hash(hasher) #
Description copied from struct Struct

See Object#hash(hasher)


[View source]
def keys : Array(String) #

[View source]
def size : Int32 #
Description copied from module Enumerable({String, String})

Returns the number of elements in the collection.

[1, 2, 3, 4].size # => 4

[View source]
def to_h : Hash(String, String) #
Description copied from module Enumerable({String, String})

Creates a Hash out of an Enumerable where each element is a 2 element structure (for instance a Tuple or an Array).

[[:a, :b], [:c, :d]].to_h        # => {:a => :b, :c => :d}
Tuple.new({:a, 1}, {:c, 2}).to_h # => {:a => 1, :c => 2}

[View source]
def values : Array(String) #

[View source]