summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/zorglub/session.rb16
1 files 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
#