struct Tourmaline::Middleware::Context

Defined in:

tourmaline/middleware.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def get(name, type : T.class) forall T #

Returns the value of the parameter with the provided name as a type.


[View source]
def get(name) #

Returns the value of the parameter with the provided name.

Raises a KeyError if no parameter with that name exists.


[View source]
def get?(name, type : T.class) forall T #

Returns the value of the parameter with the provided name as a type if it exists, otherwise nil.


[View source]
def get?(name) #

Returns the value of the parameter with the provided name if it exists, otherwise nil.


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

Returns true if a parameter with the provided name exists, otherwise false.


[View source]
def initialize #

[View source]
def remove(name) : Nil #

Removes the parameter with the provided name.


[View source]
def set(name, value : _, type : T.class) : Nil forall T #

Sets a parameter with the provided name to value, restricted to the given type.


[View source]
def set(name, value : T) : Nil forall T #

Sets a parameter with the provided name to value.


[View source]
def set(name, type : T.class, &block : -> T) : Nil forall T #

Sets a lazy parameter with the provided name to the return value of the provided block, restricted to the given type.


[View source]
def set(name, &block : -> T) : Nil forall T #

Sets a lazy parameter with the provided name to the return value of the provided block.


[View source]