[Ruby-session-devel-cvs] CVS: ruby-session/src/apache/session file.rb,1.3,1.4
Status: Alpha
Brought to you by:
thetitan
From: Sean C. <the...@us...> - 2001-11-18 23:53:52
|
Update of /cvsroot/ruby-session/ruby-session/src/apache/session In directory usw-pr-cvs1:/tmp/cvs-serv11942 Modified Files: file.rb Log Message: Location isn't always specified: use a write-through accessor method that'll create the location if it hasn't been already. Removed duplicate make_location function that was older than the maintained version in session.rb Index: file.rb =================================================================== RCS file: /cvsroot/ruby-session/ruby-session/src/apache/session/file.rb,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- file.rb 2001/11/18 21:35:08 1.3 +++ file.rb 2001/11/18 23:53:49 1.4 @@ -49,7 +49,7 @@ def _delete () begin - File.delete(@location) + File.delete(self.location) rescue Errno::ENOENT raise RuntimeError, "Unable to delete session #{@session_id}" end @@ -67,7 +67,7 @@ def _exist? () - return(Session._exist?(@location)) + return(Session._exist?(self.location)) end # def _exist? @@ -77,21 +77,14 @@ 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 # def make_location - - def _persist () - self.make_location() unless(@location) - begin - f = File.new(@location, File::CREAT|File::TRUNC|File::WRONLY|File::EXCL, 0600) + f = File.new(self.location, File::CREAT|File::TRUNC|File::WRONLY|File::EXCL, 0600) Marshal.dump(@data, f) f.close() rescue Errno::EEXIST self.restore - f = File.new(@location, File::TRUNC|File::WRONLY, 0600) + f = File.new(self.location, File::TRUNC|File::WRONLY, 0600) Marshal.dump(@data, f) f.close() end @@ -100,7 +93,7 @@ def _restore () begin - f = File.new(@location, File::RDONLY) + f = File.new(self.location, File::RDONLY) @data.update(Marshal.load(f)) f.close rescue Errno::ENOENT |