Skip navigation

Monthly Archives: May 2007

ruby ugliness

Wouldn’t it be nice to define a Hash for which each heretofore undefined element is a Set? Probably should be something like, right? Then we could write this function: def group_by_basename(paths, result = first, *rest = paths result[File.basename(first)] << first rest.empty? ? result : group_by_basename(rest, result) end And test it with a bunch […]