controller icon indicating copy to clipboard operation
controller copied to clipboard

Establish `Hanami::Action#call` as Public API

Open jodosha opened this issue 3 years ago • 0 comments

Enhancement

Re-establish Hanami::Action#call as Public API for Hanami 2.0 actions.

During the Hanami 2.0 rewriting, we had to gave up to a Hanami signature method #call for actions in favor of #handle. This was to reduce the internal complexity (meta-programming) of Hanami::Action.

Implementation details

Introduce Hanami::Action::Proxy, a wrapper around Hanami::Action that acts as an adapter with Rack. It's responsible to prepare the execution (instantiate request, response, run callbacks) and finally invokes Hanami::Action#call.

This wrapper eliminates the need of meta-programming to keep Hanami::Action#call as Public API.

For each incoming Rack request

[rack server] --> [router] --> *[action proxy] --> [action]

* new addition of this PR.

jodosha avatar Jul 10 '22 14:07 jodosha