X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Ffilesystem.rb;fp=lib%2Ffilesystem.rb;h=473a1ed16a46032a1c4c6f37be56a8bd81f6a9e3;hp=0000000000000000000000000000000000000000;hb=a3574c5b85a11d30ad3cb067818e99607625eb73;hpb=6ea85440cad9212639af782bd758a8eccd55f90e diff --git a/lib/filesystem.rb b/lib/filesystem.rb new file mode 100644 index 0000000..473a1ed --- /dev/null +++ b/lib/filesystem.rb @@ -0,0 +1,22 @@ +class Filesystem + + def self.begins_with_dot(path) + return (path[0..0] == '.') + end + + def self.get_subdirs(dir) + subdirs = [] + + Dir.open(dir) do |d| + d.each do |entry| + relative_path = File.join(dir, entry) + if (File.directory?(relative_path) and not begins_with_dot(entry)) + subdirs << entry + end + end + end + + return subdirs + end + +end