This is a bit of a micro question, but every time I create a gem and need to load all the files under a subdirectory for some sort of reflective purpose (or just a quick and dirty pre-load), I ask myself "surely there has to be a cleaner way?", in reference to this common pattern:
Dir[File.join(File.dirname(__FILE__), "subdirectory/**/*.rb")].each { |f| require f }
The need to call File.dirname
on __FILE__
that makes it needlessly verbose. You can't really use a relative path inside a gem, since you have no idea where you're being loaded from.