UtopiaSourceUtopiaControllerRewriteClassMethods

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 controller Utopia::Controller::Base

The controller instance.

parameter request Rack::Request

The request.

parameter path Utopia::Path | String

The path.

returns Array(String) | Nil

The rewritten components, or nil when no rewriter is configured.

Implementation

def rewrite_request(controller, request, path)
	if @rewriter
		@rewriter.call(controller, request, path)
	end
end