# HG changeset patch # User Mahlon E. Smith # Date 1495665759 25200 # Node ID f8873b391f3d4326831db66a24f6776562742870 # Parent eedb2586dea4177de27815c21c364ee97023b08b Add a "last activity" method to quickly determine when a list was last used. Bump version. diff -r eedb2586dea4 -r f8873b391f3d lib/ezmlm.rb --- a/lib/ezmlm.rb Tue May 16 22:28:21 2017 -0700 +++ b/lib/ezmlm.rb Wed May 24 15:42:39 2017 -0700 @@ -14,7 +14,7 @@ # $Id$ # Package version - VERSION = '1.0.2' + VERSION = '1.1.0' # Suck in the components. # diff -r eedb2586dea4 -r f8873b391f3d lib/ezmlm/list.rb --- a/lib/ezmlm/list.rb Tue May 16 22:28:21 2017 -0700 +++ b/lib/ezmlm/list.rb Wed May 24 15:42:39 2017 -0700 @@ -664,6 +664,16 @@ end + ### Return a Time object for the last activity on the list, or nil + ### if archiving is disabled or there are no posts. + ### + def last_activity + file = self.listdir + 'archnum' + return unless file.exist? + return file.stat.mtime + end + + ### Parse all thread indexes into a single array that can be used ### as a lookup table. ### diff -r eedb2586dea4 -r f8873b391f3d spec/ezmlm/list_spec.rb --- a/spec/ezmlm/list_spec.rb Tue May 16 22:28:21 2017 -0700 +++ b/spec/ezmlm/list_spec.rb Wed May 24 15:42:39 2017 -0700 @@ -236,6 +236,10 @@ expect( list.digest_count ).to eq( 10 ) end + it 'knows the date of the most recent posting' do + expect( list.last_activity ).to be_a( Time ) + end + it 'can set a new digest message count' do list.digest_count = 25 expect( list.digest_count ).to eq( 25 )