Sha256: 45ce297a4bf2bf693db5810589453d2aa83b794560dc2351fa8bc663626331b7

Contents?: true

Size: 1.2 KB

Versions: 20

Compression:

Stored size: 1.2 KB

Contents

module Hanami
  module Action
    module Rack
      module Callable
        # Callable module for actions. With this module, actions with middlewares
        # will be able to work with rack builder.
        #
        # @param env [Hash] the full Rack env or the params. This value may vary,
        #   see the examples below.
        #
        # @since 0.4.0
        # @api private
        #
        # @see Hanami::Action::Rack::ClassMethods#rack_builder
        # @see Hanami::Action::Rack::ClassMethods#use
        #
        # @example
        #   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
        def call(env)
          rack_builder.call(env)
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
hanami-controller-1.3.3 lib/hanami/action/rack/callable.rb
hanami-controller-1.3.2 lib/hanami/action/rack/callable.rb
hanami-controller-1.3.1 lib/hanami/action/rack/callable.rb
hanami-controller-1.3.0 lib/hanami/action/rack/callable.rb
hanami-controller-1.3.0.beta1 lib/hanami/action/rack/callable.rb
hanami-controller-1.2.0 lib/hanami/action/rack/callable.rb
hanami-controller-1.2.0.rc2 lib/hanami/action/rack/callable.rb
hanami-controller-1.2.0.rc1 lib/hanami/action/rack/callable.rb
hanami-controller-1.2.0.beta2 lib/hanami/action/rack/callable.rb
hanami-controller-1.2.0.beta1 lib/hanami/action/rack/callable.rb
hanami-controller-1.1.1 lib/hanami/action/rack/callable.rb
hanami-controller-1.1.0 lib/hanami/action/rack/callable.rb
hanami-controller-1.1.0.rc1 lib/hanami/action/rack/callable.rb
hanami-controller-1.1.0.beta3 lib/hanami/action/rack/callable.rb
hanami-controller-1.1.0.beta2 lib/hanami/action/rack/callable.rb
hanami-controller-1.1.0.beta1 lib/hanami/action/rack/callable.rb
hanami-controller-1.0.1 lib/hanami/action/rack/callable.rb
hanami-controller-1.0.0 lib/hanami/action/rack/callable.rb
hanami-controller-1.0.0.rc1 lib/hanami/action/rack/callable.rb
hanami-controller-1.0.0.beta3 lib/hanami/action/rack/callable.rb