More Ruby Zen

Posted: Wed, 22 February 2006 | permalink | No comments

A method to find all files in a directory INCOMING which end with .changes, prepend INCOMING to the matching files, and return the results as an array (desk checked, but not run in anger yet):

def changes_files
  Dir.entries(INCOMING).find_all { |f| 
    f =~ /\.changes$/ }.map { |f| File.join(INCOMING, f) }
end

Line noise it may be, but I'll be damned if it isn't succinct line noise.


Comments on this post are closed.