I am learning how to create my own gems today, but I have not been able
to find out how to configure the gem to accept configuration arguments.
If that didn’t make any sense let me show you what I mean
In my gem I have a base class, that is setup like this:
@@config_file = '' cattr_accessor :config_file def initialize @@config = YAML.load_file(@@config_file) end
I want to be able to set the option for the config at the top of a
script so that I don’t have to do it for each class instance. Something
MyGem::Base.config_file = ‘…/my_config.yml’
This is not working. I realized the the cattr_accessor needs
activesupport and I have added the necessary requires, but I am getting
an “undefined method” error when I try to use the gem. If there is
another way to do this I would love to know.
Sorry, if this doesn’t make any sense. If you would like more details
please let me know.