lib/ezmlm.rb
changeset 6 66beb495a861
parent 5 804e1c2b9a40
child 12 3cc813140c80
equal deleted inserted replaced
5:804e1c2b9a40 6:66beb495a861
    40 
    40 
    41 	###############
    41 	###############
    42 	module_function
    42 	module_function
    43 	###############
    43 	###############
    44 
    44 
       
    45 	### Find all directories that look like an Ezmlm list directory under the specified +listsdir+
       
    46 	### and return Pathname objects for each.
       
    47 	def find_directories( listsdir )
       
    48 		listsdir = Pathname.new( listsdir )
       
    49 		return Pathname.glob( listsdir + '*' ).select do |entry|
       
    50 			entry.directory? && ( entry + 'mailinglist' ).exist?
       
    51 		end
       
    52 	end
       
    53 	
    45 
    54 
    46 	### Iterate over each directory that looks like an Ezmlm list in the specified +listsdir+ and
    55 	### Iterate over each directory that looks like an Ezmlm list in the specified +listsdir+ and
    47 	### yield it as an Ezmlm::List object.
    56 	### yield it as an Ezmlm::List object.
    48 	def each_list( listsdir )
    57 	def each_list( listsdir )
    49 		listsdir = Pathname.new( listsdir )
    58 		find_directories( listsdir ).each do |entry|
    50 		Pathname.glob( listsdir + '*' ) do |entry|
       
    51 			next unless entry.directory?
       
    52 			next unless ( entry + 'mailinglist' ).exist?
       
    53 
       
    54 			yield( Ezmlm::List.new(entry) )
    59 			yield( Ezmlm::List.new(entry) )
    55 		end
    60 		end
    56 	end
    61 	end
    57 	
    62 	
    58 
    63