abstract class
Lucky::Action
- Lucky::Action
- Reference
- Object
Included Modules
- Lucky::ActionDelegates
- Lucky::ActionPipes
- Lucky::Exposable
- Lucky::ParamHelpers
- Lucky::Redirectable
- Lucky::Renderable
- Lucky::RequestBodyLimit
- Lucky::RequestTypeHelpers
- Lucky::Routable
- Lucky::VerifyAcceptsFormat
Defined in:
lucky/action.crConstant Summary
-
AFTER_PIPES =
{} of Symbol => Bool -
BEFORE_PIPES =
{verify_accepted_format => true} of Symbol => Bool -
EXPOSURES =
[] of Symbol -
PARAM_DECLARATIONS =
[] of Crystal::Macros::TypeDeclaration -
ROUTE_SETTINGS =
{prefix: ""}
Constructors
Class Method Summary
- ._accepted_formats : Array(Symbol)
- .query_param_declarations : Array(String)
- .request_body_limit : Int64 | Nil
-
.valid_path_params?(route_params : Hash(String, String)) : Bool
Returns whether the matched route params satisfy the action's declared
Lucky::PathParamtypes.
Instance Method Summary
- #call
- #context : HTTP::Server::Context
- #cookies(*args, **options)
- #cookies(*args, **options, &)
- #flash(*args, **options)
- #flash(*args, **options, &)
- #request(*args, **options)
- #request(*args, **options, &)
- #response(*args, **options)
- #response(*args, **options, &)
- #route_params : Hash(String, String)
- #session(*args, **options)
- #session(*args, **options, &)
Instance methods inherited from module Lucky::VerifyAcceptsFormat
clients_desired_format : Symbol
clients_desired_format
Macros inherited from module Lucky::VerifyAcceptsFormat
accepted_formats(formats)accepted_formats(formats, default) accepted_formats
Instance methods inherited from module Lucky::Redirectable
redirect(to route : Lucky::RouteHelper, status = Lucky::Redirectable.settings.redirect_status) : Lucky::TextResponseredirect(to action : Lucky::Action.class, status = Lucky::Redirectable.settings.redirect_status) : Lucky::TextResponse
redirect(to path : String, status : HTTP::Status) : Lucky::TextResponse
redirect(to path : String, status : Int32 = Lucky::Redirectable.settings.redirect_status) : Lucky::TextResponse redirect, redirect_back(*, fallback : Lucky::Action.class, status = Lucky::Redirectable.settings.redirect_status, allow_external = false) : Lucky::TextResponse
redirect_back(*, fallback : Lucky::RouteHelper, status = Lucky::Redirectable.settings.redirect_status, allow_external = false) : Lucky::TextResponse
redirect_back(*, fallback : String, status : HTTP::Status, allow_external = false) : Lucky::TextResponse
redirect_back(*, fallback : String, status : Int32 = Lucky::Redirectable.settings.redirect_status, allow_external : Bool = false) : Lucky::TextResponse redirect_back, settings settings
Class methods inherited from module Lucky::Redirectable
configure(&)
configure,
settings
settings
Macros inherited from module Lucky::RequestBodyLimit
clear_request_body_limit
clear_request_body_limit,
set_request_body_limit(bytes)
set_request_body_limit
Instance methods inherited from module Lucky::ActionPipes
continue : Lucky::ActionPipes::Continue
continue
Macros inherited from module Lucky::ActionPipes
after(method_name)
after,
before(method_name)
before,
skip(*pipes)
skip
Instance methods inherited from module Lucky::ParamHelpers
params : Lucky::Params
params,
params__tuple_cached : Tuple(Lucky::Params)
params__tuple_cached,
params__uncached : Lucky::Params
params__uncached
Instance methods inherited from module Lucky::Renderable
component(comp : Lucky::BaseComponent.class, status : Int32 | Nil = nil, **named_args) : Lucky::TextResponsecomponent(comp : Lucky::BaseComponent.class, status : HTTP::Status, **named_args) : Lucky::TextResponse component, data(data : String, content_type : String = "application/octet-stream", disposition : String = "attachment", filename : String | Nil = nil, status : Int32 | Nil = nil) : Lucky::DataResponse data, file(path : String, content_type : String | Nil = nil, disposition : String = "attachment", filename : String | Nil = nil, status : Int32 | Nil = nil) : Lucky::FileResponse
file(path : String, content_type : String | Nil = nil, disposition : String = "attachment", filename : String | Nil = nil, status : HTTP::Status = HTTP::Status::OK) : Lucky::FileResponse file, head(status : Int32) : Lucky::TextResponse
head(status : HTTP::Status) : Lucky::TextResponse head, html_content_type : String html_content_type, json(body, status : Int32 | Nil = nil, content_type : String = json_content_type) : Lucky::TextResponse
json(body, status : HTTP::Status, content_type : String = json_content_type) : Lucky::TextResponse json, json_content_type : String json_content_type, plain_content_type : String plain_content_type, plain_text(body : String, status : Int32 | Nil = nil, content_type : String = plain_content_type) : Lucky::TextResponse
plain_text(body : String, status : HTTP::Status, content_type : String = plain_content_type) : Lucky::TextResponse plain_text, raw_json(body : String, status : Int32 | Nil = nil, content_type : String = json_content_type) : Lucky::TextResponse
raw_json(body : String, status : HTTP::Status, content_type : String = json_content_type) : Lucky::TextResponse raw_json, send_text_response(body : String, content_type : String, status : Int32 | Nil = nil) : Lucky::TextResponse send_text_response, xml(body : String, status : Int32 | Nil = nil, content_type : String = xml_content_type) : Lucky::TextResponse
xml(body, status : HTTP::Status, content_type : String = xml_content_type) : Lucky::TextResponse xml, xml_content_type : String xml_content_type
Macros inherited from module Lucky::Renderable
disable_cookies
disable_cookies,
html(page_class = nil, _with_status_code = 200, **assigns)
html,
html_with_status(page_class, status, **assigns)
html_with_status
Macros inherited from module Lucky::Routable
delete(path, *path_aliases)
delete,
enforce_route_style(path, action)
enforce_route_style,
fallback
fallback,
get(path, *path_aliases)
get,
inherit_route_settings
inherit_route_settings,
match(method, path)
match,
param(type_declaration)
param,
patch(path, *path_aliases)
patch,
post(path, *path_aliases)
post,
put(path, *path_aliases)
put,
route_prefix(prefix)
route_prefix,
trace(path, *path_aliases)
trace
Macros inherited from module Lucky::Exposable
expose(method_name)
expose
Instance methods inherited from module Lucky::RequestTypeHelpers
accepts?(format : Symbol) : Bool
accepts?,
ajax? : Bool
ajax?,
html? : Bool
html?,
json? : Bool
json?,
multipart? : Bool
multipart?,
plain_text? : Bool
plain_text?,
url_format : Lucky::Format | Lucky::FormatRegistry::CustomFormat | Nil
url_format,
xml? : Bool
xml?
Macros inherited from module Lucky::RequestTypeHelpers
default_format(format)
default_format
Instance methods inherited from class Object
blank? : Bool
blank?,
present? : Bool
present?
Constructor Detail
Class Method Detail
Returns whether the matched route params satisfy the action's declared
Lucky::PathParam types. Actions without typed route params always
return true. The Lucky::RouteHandler uses this to treat a segment
that can't be parsed to its declared type as a non-match.