Matches files using Dir.glob… and so much more.
Some examples:
# Finds /home/adam/x -- same as Dir.glob GlobFu.find('/home/adam/x') # Finds /home/adam/* -- same as Dir.glob GlobFu.find('/home/adam/*') # Iterates over /home/adam/* -- same as Dir.glob GlobFu.find('/home/adam/*') { |f| puts f } # Finds /home/adam/.../x -- same as Dir.glob GlobFu.find('/home/adam/**/x') # Finds /home/adam/* GlobFu.find('*', :root => '/home/adam') # Finds /home/adam/* and /home/adam/subdir/* GlobFu.find('*', 'subdir/*', :root => '/home/adam') GlobFu.find(['*', 'subdir/*'], :root => '/home/adam') # Finds /*.txt but not /*.anything.txt GlobFu.find('/*', :suffix => 'txt') # Finds /*.txt, including /*.anything.txt -- just don't use :suffix GlobFu.find('/*.txt') # Finds /*.txt(.gz)?, preferring .gz but falling back to plain .txt GlobFu.find('/*', :suffix => 'txt', :optional_suffix => 'gz') # Finds /*.something.txt GlobFu.find('/*', :suffix => 'txt', :extra_suffix => 'something')
-
Removes duplicates
-
Sorts each glob alphabetically, for consistent results
I believe in software freedom, not any abomination thereof. This project is released under the Public Domain, meaning I relinquish my copyright (to any extend the law allows) and grant you all rights to use, modify, sell, or otherwise take advantage of my software.
However, I do kindly request that, as a favor, you refrain from using my software as part of an evil plan involving velociraptors and mind-controlling robots (even though I would not be legally entitled to sue you for doing so).
-
Adam Hooper