Sha256: 0d303da6c2fb8853a0b92e80b7d4a5088b18598f52b6c3fb4f83c6798b21f260

Contents?: true

Size: 1.12 KB

Versions: 9

Compression:

Stored size: 1.12 KB

Contents

# encoding: utf-8
module Warden
  module Mixins
    module Common

      # Convinience method to access the session
      # :api: public
      def session
        env['rack.session']
      end # session

      # Alias :session to :raw_session since the former will be user API for storing scoped data.
      alias :raw_session :session

      # Convenience method to access the rack request.
      # :api: public
      def request
        @request ||= Rack::Request.new(@env)
      end # request

      # Convenience method to access the rack response. This should be replaced by the
      # actual response returned to the client.
      # :api: public
      def response
        @response ||= Rack::Response.new(@env)
      end # response

      # Convenience method to access the rack request params
      # :api: public
      def params
        request.params
      end # params

      # Resets the session.  By using this non-hash like sessions can
      # be cleared by overwriting this method in a plugin
      # @api overwritable
      def reset_session!
        raw_session.clear
      end
    end # Common
  end # Mixins
end # Warden

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
warden-0.8.1 lib/warden/mixins/common.rb
warden-0.8.0 lib/warden/mixins/common.rb
warden-0.7.0 lib/warden/mixins/common.rb
warden-0.6.5 lib/warden/mixins/common.rb
warden-0.6.4 lib/warden/mixins/common.rb
warden-0.6.3 lib/warden/mixins/common.rb
warden-0.6.2 lib/warden/mixins/common.rb
warden-0.6.1 lib/warden/mixins/common.rb
warden-0.6.0 lib/warden/mixins/common.rb