Home constant for building paths from root directory onward.
TODO: Pathname#home needs to be more robust.
Returns [Pathname]
Does a directory contain a matching entry? Or if the pathname is a file, same as fnmatch.
TODO: Move to own file? Better name?
Returns [Pathname]
Reads the first line of the file
Captures the best practice from this post at stack overflow: stackoverflow.com/questions/1490138/reading-the-first-line-of-a-file-in-ruby
Credit: Ryan Duryea
Recursively visit a directory located by its path, yielding each resource as its full matching pathname object. If called on a file, yield the file.
Examples
# Locate any file but *.haml within app/**/* Pathname.new("app").visit do |f| next unless f.to_s =~ /\.haml$/ f end
TODO: Use map instead of each?
CREDIT: Jean-Denis Vauguet