Sha256: f69de1f5d53560abafeb58498dfa0f43b9481b5984b7dafacda1dd8b8604ca4b

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

module RubyApp

  module Rack
    require 'ruby_app'

    class Session

      def initialize(application)
        @application = application
      end

      def call(environment)
        RubyApp::Session.load!(RubyApp::Request.cookies['_session'])
        begin
          #RubyApp::Log.debug("#{RubyApp::Log.prefix(self, __method__)} RubyApp::Session.session_id=#{RubyApp::Session.session_id.inspect}")
          #RubyApp::Log.debug("#{RubyApp::Log.prefix(self, __method__)} RubyApp::Session.expires=#{RubyApp::Session.expires.inspect}")
          #RubyApp::Log.debug("#{RubyApp::Log.prefix(self, __method__)}                    (now)=#{Time.now.inspect}")
          RubyApp::Response.set_cookie('_session', { :value    => RubyApp::Session.session_id,
                                                     :expires  => RubyApp::Session.expires,
                                                     :path     => '/'})
          return @application.call(environment)
        ensure
          RubyApp::Session.unload!
        end
      end

    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
RubyApp-0.2.7 lib/ruby_app/rack/session.rb
RubyApp-0.2.6 lib/ruby_app/rack/session.rb
RubyApp-0.2.5 lib/ruby_app/rack/session.rb