struct Tourmaline::Middleware::Context
inherits Struct
#
Constructors#
Methods#
#get(name, type : T.class) forall T
#
(name, type : T.class) forall T
Returns the value of the parameter with the provided name as a type
.
#get(name)
#
(name)
Returns the value of the parameter with the provided name.
Raises a KeyError
if no parameter with that name exists.
#get?(name, type : T.class) forall T
#
(name, type : T.class) forall T
Returns the value of the parameter with the provided name as a type
if it exists, otherwise nil
.
#get?(name)
#
(name)
Returns the value of the parameter with the provided name if it exists, otherwise nil
.
#has?(name) : Bool
#
(name) : Bool
Returns true
if a parameter with the provided name exists, otherwise false
.
#set(name, value : _, type : T.class) : Nil forall T
#
(name, value : _, type : T.class) : Nil forall T
Sets a parameter with the provided name to value, restricted to the given type.
#set(name, value : T) : Nil forall T
#
(name, value : T) : Nil forall T
Sets a parameter with the provided name to value.
#set(name, type : T.class, &block : -> T) : Nil forall T
#
(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.
#set(name, &block : -> T) : Nil forall T
#
(name, &block : -> T) : Nil forall T
Sets a lazy parameter with the provided name to the return value of the provided block.