Project

file_glob

0.0
No commit activity in last 3 years
No release in over 3 years
Use FileGlob in place of a Regexp when shell pattern matching makes more sense.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

FileGlob

Quacks like a Regexp, tastes like Dir.glob.

Use FileGlob in place of a Regexp when shell pattern matching makes more sense.

Usage

Filter a set of file paths:

glob = FileGlob.new("test/**/*_test.rb")
paths.select{|path| path =~ glob }

Perform different actions for different file types:

image = FileGlob.new("*.{png,jpg,gif}")
text  = FileGlob.new("*.txt")

case path
when image then process_image(path)
when text  then process_text(path)
end

Installation

Install with rubygems:

gem install file_glob

Adam Sanderson, http://www.monkeyandcrow.com