lib/ezmlm.rb
changeset 6 66beb495a861
parent 5 804e1c2b9a40
child 12 3cc813140c80
--- a/lib/ezmlm.rb	Sat May 10 01:52:42 2008 +0000
+++ b/lib/ezmlm.rb	Wed Aug 06 17:24:00 2008 +0000
@@ -42,15 +42,20 @@
 	module_function
 	###############
 
+	### Find all directories that look like an Ezmlm list directory under the specified +listsdir+
+	### and return Pathname objects for each.
+	def find_directories( listsdir )
+		listsdir = Pathname.new( listsdir )
+		return Pathname.glob( listsdir + '*' ).select do |entry|
+			entry.directory? && ( entry + 'mailinglist' ).exist?
+		end
+	end
+	
 
 	### Iterate over each directory that looks like an Ezmlm list in the specified +listsdir+ and
 	### yield it as an Ezmlm::List object.
 	def each_list( listsdir )
-		listsdir = Pathname.new( listsdir )
-		Pathname.glob( listsdir + '*' ) do |entry|
-			next unless entry.directory?
-			next unless ( entry + 'mailinglist' ).exist?
-
+		find_directories( listsdir ).each do |entry|
 			yield( Ezmlm::List.new(entry) )
 		end
 	end