module ClassMethods
Exposed to the controller class.
Definitions
def rewrite
Return this controller's path rewriter.
Signature
-
returns
Rewriter The path rewriter.
Implementation
def rewrite
@rewriter ||= Rewriter.new
end
def rewrite_request(controller, request, path)
Apply configured rewrite rules to the request path.
Signature
-
parameter
controllerUtopia::Controller::Base The controller instance.
-
parameter
requestRack::Request The request.
-
parameter
pathUtopia::Path | String The path.
-
returns
Array(String) | Nil The rewritten components, or
nilwhen no rewriter is configured.
Implementation
def rewrite_request(controller, request, path)
if @rewriter
@rewriter.call(controller, request, path)
end
end