This library is no longer maintained. Everything it does and so much more is now provided by github.com/joshbuddy/callsite. To get back Dirge's specific functionality, you can do the following
gem install 'callsite'
And in ruby
Now everything below will work as-is!
require 'dirge' require_relative '../to_my_file'
Or, the much simpler notation
class MyAwesomeClass autoload_relative :MyConstant, 'my_awesome_class/my_constant' end
Again, this could be
class MyAwesomeClass autoload :MyConstant, ~'my_awesome_class/my_constant' end
All of this is powered by the new function:
which takes a single line off of
Kernel.caller and give you
back the relative path. Calling __DIR__(caller.first) for instance, will
give you the relative path to whoever called you.
There is also a more explicit, and probably, more readable version.
This will convert your path into a relative directory from wherever you are.
should be identical.