Module: Brut::FrontEnd::HandlingResults
Overview
Convienience methods to use inside handlers to make it easier to return richly typed results.
Instance Method Summary collapse
-
#http_status(number) ⇒ Object
Return this to return an HTTP status code from a number or string containing the code.
-
#redirect_to(klass, **query_string_params) ⇒ Object
Return this to cause your handler to redirect to
klass
' route with the given query string parameters.
Instance Method Details
#http_status(number) ⇒ Object
Return this to return an HTTP status code from a number or string containing the code.
22 |
# File 'lib/brut/front_end/handling_results.rb', line 22 def http_status(number) = Brut::FrontEnd::HttpStatus.new(number) |
#redirect_to(klass, **query_string_params) ⇒ Object
Return this to cause your handler to redirect to klass
' route with the given query string parameters.
be provided in query_string_params
or this will raise an error. Note that the class must be for a GET route, since you cannot
redirect to a non-GET.
14 15 16 17 18 19 |
# File 'lib/brut/front_end/handling_results.rb', line 14 def redirect_to(klass, **query_string_params) if !klass.kind_of?(Class) raise ArgumentError,"redirect_to should be given a Class, not a #{klass.class}" end Brut.container.routing.path(klass,with_method: :get,**query_string_params) end |