struct Tourmaline::Middleware::Context
- Tourmaline::Middleware::Context
- Struct
- Value
- Object
Defined in:
tourmaline/middleware.crConstructors
Instance Method Summary
-
#get(name, type : T.class) forall T
Returns the value of the parameter with the provided name as a
type
. -
#get(name)
Returns the value of the parameter with the provided name.
-
#get?(name, type : T.class) forall T
Returns the value of the parameter with the provided name as a
type
if it exists, otherwisenil
. -
#get?(name)
Returns the value of the parameter with the provided name if it exists, otherwise
nil
. -
#has?(name) : Bool
Returns
true
if a parameter with the provided name exists, otherwisefalse
. - #initialize
-
#remove(name) : Nil
Removes the parameter with the provided name.
-
#set(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
Sets a parameter with the provided name to value.
-
#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.
-
#set(name, &block : -> T) : Nil forall T
Sets a lazy parameter with the provided name to the return value of the provided block.
Constructor Detail
Instance Method Detail
Returns the value of the parameter with the provided name as a type
.
Returns the value of the parameter with the provided name.
Raises a KeyError
if no parameter with that name exists.
Returns the value of the parameter with the provided name as a type
if it exists, otherwise nil
.
Returns the value of the parameter with the provided name if it exists, otherwise nil
.
Sets a parameter with the provided name to value, restricted to the given type.
Sets a lazy parameter with the provided name to the return value of the provided block, restricted to the given type.
Sets a lazy parameter with the provided name to the return value of the provided block.