summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-01-04 14:23:32 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2012-01-04 14:23:32 +0100
commitb538b3c6519bd5dc026c488bbeab683695abc320 (patch)
tree74cd7e82c569b12d0e3f28fc18655dbca90ccbd0
parentfd132ece1fc6792eaf4872703ad40fe926ed3434 (diff)
downloadzorglub-b538b3c6519bd5dc026c488bbeab683695abc320.zip
zorglub-b538b3c6519bd5dc026c488bbeab683695abc320.tar.gz
session: add #destroy!
-rw-r--r--lib/zorglub/session.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/zorglub/session.rb b/lib/zorglub/session.rb
index a20dfcc..8162cf1 100644
--- a/lib/zorglub/session.rb
+++ b/lib/zorglub/session.rb
@@ -28,6 +28,11 @@ module Zorglub
@session_data = SessionHash.data[sid]||={}
end
#
+ def destroy!
+ SessionHash.data.delete @sid
+ @session_data = nil
+ @sid = nil
+ end
#
def [] idx
@session_data[idx]
@@ -66,6 +71,12 @@ module Zorglub
end
private :setup!
#
+ def destroy!
+ @response.delete_cookie Session.key
+ @instance.destroy! if @instance
+ @instance = nil
+ end
+ #
def sid
setup! if @instance.nil?
return nil if @instance.nil?