Add a "last activity" method to quickly determine when a list was last used. Bump version.
This commit is contained in:
parent
b463593c26
commit
33b3c08d75
3 changed files with 15 additions and 1 deletions
|
|
@ -14,7 +14,7 @@ module Ezmlm
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
# Package version
|
# Package version
|
||||||
VERSION = '1.0.2'
|
VERSION = '1.1.0'
|
||||||
|
|
||||||
# Suck in the components.
|
# Suck in the components.
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -664,6 +664,16 @@ class Ezmlm::List
|
||||||
end
|
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
|
### Parse all thread indexes into a single array that can be used
|
||||||
### as a lookup table.
|
### as a lookup table.
|
||||||
###
|
###
|
||||||
|
|
|
||||||
|
|
@ -236,6 +236,10 @@ describe Ezmlm::List do
|
||||||
expect( list.digest_count ).to eq( 10 )
|
expect( list.digest_count ).to eq( 10 )
|
||||||
end
|
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
|
it 'can set a new digest message count' do
|
||||||
list.digest_count = 25
|
list.digest_count = 25
|
||||||
expect( list.digest_count ).to eq( 25 )
|
expect( list.digest_count ).to eq( 25 )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue