From fd132ece1fc6792eaf4872703ad40fe926ed3434 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 4 Jan 2012 14:23:17 +0100 Subject: session: remove #exists?, add #sid --- lib/zorglub/session.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/zorglub/session.rb b/lib/zorglub/session.rb index da2c3f0..a20dfcc 100644 --- a/lib/zorglub/session.rb +++ b/lib/zorglub/session.rb @@ -16,17 +16,18 @@ module Zorglub @data = {} class << self attr_reader :data + def sid_exists? sid + not @data[sid].nil? + end end # + attr_reader :sid + # def initialize sid @sid = sid - # TODO if sid is nil, one should be created @session_data = SessionHash.data[sid]||={} end # - def exists? - not @sid.nil? - end # def [] idx @session_data[idx] @@ -65,18 +66,21 @@ module Zorglub end private :setup! # - def exists? + def sid setup! if @instance.nil? - @instance.exists? + return nil if @instance.nil? + @instance.sid end # def [] idx setup! if @instance.nil? + return nil if @instance.nil? @instance[idx] end # def []= idx, v setup! if @instance.nil? + return nil if @instance.nil? @instance[idx] = v end # -- cgit v1.1-2-g2b99