]>
gitweb.michael.orlitzky.com - mailshears.git/blob - lib/common/filesystem.rb
b44e52ce3979506a82155a9db9ac658257c6b19a
2 # Convenience methods for working with the filesystem. This class
3 # only provides static methods, to be used analogously to the File
4 # class (for example, File.directory?).
7 # Return whether or not the given path begins with a dot (ASCII
10 # @param path [String] the path whose first character you want to check.
12 # @return [Boolean] whether or not *path* begins with an ASCII period.
14 def self.begins_with_dot
?(path
)
15 return (path
[0..0] == '.')
19 # Get a list of all real subdirectories of the given directory.
21 # @param dir [String] the directory whose subdirectories you want.
23 # @return [Array<String>] a list of subdirectories of *dir*, not
24 # including the pseudo-directories "." and ".." (the current/parent
27 def self.get_subdirs(dir
)
32 relative_path
= File
.join(dir
, entry
)
33 if File
.directory
?(relative_path
) and not self.begins_with_dot
?(entry
)