Sha256: 90658feb68b98f7d2f66e2c8e36fd190ab3882edba4ece468d76ad9ab74a66ef

Contents?: true

Size: 666 Bytes

Versions: 109

Compression:

Stored size: 666 Bytes

Contents

# frozen-string-literal: true

#
class Roda
  module RodaPlugins
    # The response_request plugin gives the response access to the
    # related request instance via the #request method.
    #
    # Example:
    #
    #   plugin :response_request
    module ResponseRequest
      module InstanceMethods
        # Set the response's request to the current request.
        def initialize(env)
          super
          @_response.request = @_request
        end
      end

      module ResponseMethods
        # The request related to this response.
        attr_accessor :request
      end
    end

    register_plugin(:response_request, ResponseRequest)
  end
end

Version data entries

109 entries across 109 versions & 1 rubygems

Version Path
roda-2.19.0 lib/roda/plugins/response_request.rb
roda-2.18.0 lib/roda/plugins/response_request.rb
roda-2.17.0 lib/roda/plugins/response_request.rb
roda-2.16.0 lib/roda/plugins/response_request.rb
roda-2.15.0 lib/roda/plugins/response_request.rb
roda-2.14.0 lib/roda/plugins/response_request.rb
roda-2.13.0 lib/roda/plugins/response_request.rb
roda-2.12.0 lib/roda/plugins/response_request.rb
roda-2.11.0 lib/roda/plugins/response_request.rb