I’m writing a gem that will access a configuration yaml file in the ruby app that the gem is required in. I’ve already checked out Dir.pwd but that only gives the directory that I am running the script from. Am I thinking about this the wrong way? Here’s sort of what I’m talking about.
The gem would have a constant which could be accessed by Gem::CONSTANT. The code that instantiates this constant would be
module Gem
config_file = #code to retrieve the yaml file.
CONSTANT = config_file[:constant]
end
Then other methods would perform operations on these constants. Any help would be appreciated let me know if I need to be more specific.
Look at
File.dirname($0).$0is the absolute path/name of the currently running script.