[Ruby-session-devel-cvs] CVS: ruby-session/src session.rb,1.2,1.3
Status: Alpha
Brought to you by:
thetitan
From: Sean C. <the...@us...> - 2002-06-20 13:41:48
|
Update of /cvsroot/ruby-session/ruby-session/src In directory usw-pr-cvs1:/tmp/cvs-serv12953 Modified Files: session.rb Log Message: *) Few bug fixes to get things working. Most work done in apache/session.rb Index: session.rb =================================================================== RCS file: /cvsroot/ruby-session/ruby-session/src/session.rb,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- session.rb 20 Jun 2002 00:50:44 -0000 1.2 +++ session.rb 20 Jun 2002 13:41:39 -0000 1.3 @@ -35,7 +35,7 @@ def commit(*args) - @session_id = Session.generate() if @session_id.nil? + generate() if @session_id.nil? @@data = Marshal.dump(self) @@ -48,17 +48,25 @@ end # def commit() + def generate() + reset() + return(@session_id = Session.generate()) + end # def generate() + + def load(*args) raise "Need a Session ID" if @session_id.nil? for load_meth in @@load m = self.method(load_meth) - m.call(*args) + if m.call(*args) + break + else + next + end end # for load_meth - if @@data.nil? - return(false) - else + if !@@data.nil? obj = Marshal.load(@@data) if !@@data.nil? @active = obj.active @data = obj.data @@ -71,6 +79,8 @@ @session_id = obj.session_id @session_data = obj.session_data return(true) + else + return(false) end end # def load() @@ -90,7 +100,7 @@ def session_id() - @session_id = Session.generate() if @session_id.nil? + generate() if @session_id.nil? return(@session_id) end # def session_id() @@ -101,6 +111,11 @@ return(@session_id = session_id) end # def session_id=() + + + def to_s() + return(@session_id) + end # def to_s private |