About
Buy my book
Exceptional Ruby is the definitive guide to exceptions and failure handling in Ruby.
Pages
Categories
Tag Archives: files
Removing files with varied capitalization
Nothing ground-breaking today, just a one-liner that I expected to be longer than a one-liner. # Remove Rakefile, rakefile, RakeFile, etc… File.delete(*Dir.glob(‘rakefile’, File::FNM_CASEFOLD)) There are two notable things going on here: Dir.glob can take optional bitflags; in this case, FNM_CASEFOLD … Continue reading
Double-Load Guards in Ruby
If you’ve ever worked with C or C++ you no doubt remember that one of continual headaches of working with those languages is avoiding double-inclusions of header files. Most C headers start and end with preprocessor directives in order to … Continue reading
