Module: Hanami::Action::Rack::Callable

Defined in:
lib/hanami/action/rack/callable.rb

Overview

Since:

  • 0.1.0

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Callable module for actions. With this module, actions with middlewares will be able to work with rack builder.

Examples:

require 'hanami/controller'

 class MyMiddleware
   def initialize(app)
     @app = app
   end

   def call(env)
     #...
   end
 end

 class Show
   include Hanami::Action
   use MyMiddleware

   def call(params)
     # ...
     puts params # => { id: 23 } extracted from Rack env
   end
 end

 Show.respond_to?(:call) # => true

Parameters:

  • env (Hash)

    the full Rack env or the params. This value may vary, see the examples below.

See Also:

Since:

  • 0.4.0



41
42
43
# File 'lib/hanami/action/rack/callable.rb', line 41

def call(env)
  rack_builder.call(env)
end