Sha256: 633892359b6c0ea3fa3f8f495e31c3adf126a513da919461489baf0f698cb364
Contents?: true
Size: 580 Bytes
Versions: 1
Compression:
Stored size: 580 Bytes
Contents
module Figs module DirectoryFlattener extend self def flattened_filenames filenames return filenames if !filenames.is_a?(Array) names = [] filenames.each do |filename| Dir.exists?(filename) ? names << directory_to_filenames(filename) : names << filename end names.flatten end private def directory_to_filenames file arr = [] Dir.exists?(file) ? Dir.foreach(file) {|s| arr << directory_to_filenames("#{file}/#{s}") unless (s =='.' || s == '..')} : arr << file if File.exists?(file) arr end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
figs-1.2.3 | lib/figs/directory_flattener.rb |