Skip to content

class Athena::HTTPKernel::Action(ReturnType, ParameterTypeTuple, ParametersType)
inherits Athena::HTTPKernel::ActionBase #

Represents a controller action that will handle a request.

Includes metadata about the endpoint, such as its action parameters and return type, and the action that should be executed.

Constructors#

.new(action : Proc(ParameterTypeTuple, ReturnType), parameters : ParametersType, _return_type : ReturnType.class)#

View source

Methods#

#execute(arguments : Array) : ReturnType#

Executes this action with the provided arguments array.

View source

#parameters : ParametersType#

Returns a tuple of AHK::Controller::ParameterMetadata representing the parameters this action expects.

View source

#resolve_arguments(value_resolvers : Array, request : AHTTP::Request) : Array#

Resolves the arguments for this action for the given request.

This is defined in here as opposed to AHK::Controller::ArgumentResolver so that the free vars are resolved correctly. See https://forum.crystal-lang.org/t/incorrect-overload-selected-with-freevar-and-generic-inheritance/3625.

View source

#return_type : ReturnType.class#

Returns the type that this action returns.

View source