Skip to content

struct Tourmaline::Middleware::Context
inherits Struct #

Constructors#

.new #

View source

Methods#

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

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

View source

#get(name) #

Returns the value of the parameter with the provided name.

Raises a KeyError if no parameter with that name exists.

View source

#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

#get?(name) #

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

View source

#has?(name) : Bool #

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

View source

#remove(name) : Nil #

Removes the parameter with the provided name.

View source

#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

#set(name, value : T) : Nil forall T #

Sets a parameter with the provided name to value.

View source

#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

#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