i've got a module and a class that includes the module. these are not defined in the same file, or in the same folder. i want the module to get the directory that the class is defined in.
# ./modules/foo.rb
module Foo
def self.included(obj)
obj_dirname = # ??? what goes here?
puts "the class that included Foo was defined in this directory: #{obj_dirname}"
end
end
# ./bar.rb
class Bar
include Foo
end
i would expect the output of this to be:
the class that included Foo was defined in this directory: ../
is this possible? if so, how?