I know that I can require all the files in a directory using
Dir['path/to/files/**/*.rb'].each { |file| require file }
However, I am trying to do this for a gem installation file, for example:
class MyGem module NS; end end Dir['lib/my_gem/files/**/*.rb'].each { |file| require file }
(where all the files in lib/my_gem/files are named under MyGem :: NS). With a directory structure that looks like this:
lib |-- my_gem | |-- files | | |-- file1.rb | | |-- file2.rb | | |-- file3.rb | | `-- ... (many more) `-- my_gem.rb my_gem.gemspec
And, well, the Dir command doesn't seem to work when I need my gem in another file, as it seems to be looking for file paths at runtime in my project root directory (from any project that I have mine gemstone).
How can I require all the files in lib/my_gem/files in lib/my_gem.rb ?
ruby rubygems
neezer
source share