Update of /cvsroot/ruby-session/ruby-session/src/apache/session
In directory usw-pr-cvs1:/tmp/cvs-serv29031
Modified Files:
file.rb
Log Message:
Added more functionality... should be a good prototype for future persistence
modules
Fixd speling erors
Index: file.rb
===================================================================
RCS file: /cvsroot/ruby-session/ruby-session/src/apache/session/file.rb,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- file.rb 2001/08/25 10:31:52 1.1
+++ file.rb 2001/08/25 19:54:56 1.2
@@ -1,6 +1,6 @@
#!/usr/local/bin/ruby -w
-# ruby-session: Got persistance?
+# ruby-session: Got persistence?
# Copyright 2001
# Sean Chittenden <se...@ch...>. All rights reserved.
@@ -14,10 +14,10 @@
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
+# must display the following acknowledgment:
#
# This product includes software developed by Sean Chittenden
-# <se...@ch...> and ruby-tmpl's contributors.
+# <se...@ch...> and ruby-session's contributors.
#
# 4. Neither the name of the software nor the names of its contributors
# may be used to endorse or promote products derived from this software
@@ -47,12 +47,6 @@
protected
- def make_location ()
- @location = File.join(@session_dir, ".ruby-session-#{@session_id}")
- return(@location)
- end
-
-
def _delete ()
begin
File.delete(@location)
@@ -60,8 +54,40 @@
raise RuntimeError, "Unable to delete session #{@session_id}"
end
end
+ # End: def _delete ()
+
+
+ def Session._exist? (location)
+ begin
+ File.stat(location).readable?
+ return(true)
+ rescue Errno::ENOENT
+ return(false)
+ end
+ # End: begin
+ end
+ # End: def Session._exist? ()
+ def _exist? ()
+ return(Session._exist?(@location))
+ end
+ # End: def _exist? ()
+
+
+ def Session._make_location (*args)
+ session_id, session_dir = args.flatten
+ return(File.join(session_dir, ".ruby-session-#{session_id}"))
+ end
+ # End: def Session._make_location ()
+
+
+ def make_location (session_id = @session_id, session_dir = @session_dir)
+ return(Session._make_location(session_id, session_dir))
+ end
+ # End: def make_location ()
+
+
def _persist ()
self.make_location() unless(@location)
@@ -89,6 +115,7 @@
end
end
# End: def _restore ()
+
private
|