struct Athena::Routing::Arguments::Resolvers::DefaultValue

Overview

Handles resolving an argument's default value if no other value was able to be resolved.

@[ARTA::Get("/")]
@[ARTA::QueryParam("query_param")]
def get_query_param(query_param : Int32 = 123) : Int32
  # `query_param` would be `123` if the request does not include a query parameter named `query_param`.
  query_param
end

Included Modules

Defined in:

arguments/resolvers/default_value_resolver.cr

Constructors

Instance Method Summary

Instance methods inherited from module Athena::Routing::Arguments::Resolvers::ArgumentValueResolverInterface

resolve(request : HTTP::Request, argument : ART::Arguments::ArgumentMetadata) resolve, supports?(request : HTTP::Request, argument : ART::Arguments::ArgumentMetadata) : Bool supports?

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def initialize #

[View source]
def resolve(request : HTTP::Request, argument : ART::Arguments::ArgumentMetadata) #

Returns a value resolved from the provided request and argument.


[View source]
def supports?(request : HTTP::Request, argument : ART::Arguments::ArgumentMetadata) : Bool #

Returns true if self is able to resolve a value from the provided request and argument.


[View source]