How can I tell what directory the current file being executed is in?
This is not necessarily the same directory as returned by “Dir.pwd”.
I have “/home/seasft/dev/global” in my path. Inside this directory, there
I want entity.rb to load all the .rb files inside the “entity” directory.
I’m trying this right now:
File.find(‘entity’) do |f|
load f if f =~ /.rb$/
But, that uses the current working directory, rather than the directory
that entity.rb is located in. I can’t figure out how to determine what
directory entity.rb is in, and I’d rather not have to hardcode the path
because I have two copies of the system running in different places.