# Configuration Options in a new gem

**URL:** <https://www.ruby-forum.com/t/configuration-options-in-a-new-gem/103559>\
**Category:** Ruby\
**Created:** [May 7, 2007, 10:39pm UTC](https://www.ruby-forum.com/t/configuration-options-in-a-new-gem/103559 "2007-05-07T22:39:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pallan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/71c47a/32.png) [@pallan](https://www.ruby-forum.com/u/pallan)\
**Post date:** [May 7, 2007, 10:39pm UTC](https://www.ruby-forum.com/t/configuration-options-in-a-new-gem/103559/1 "2007-05-07T22:39:47Z")

</div>

Hi all,

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:

Module MyGem  
class Base

```
@@config_file = ''
cattr_accessor :config_file

def initialize
  @@config = YAML.load_file(@@config_file)
end

```

end  
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  
like this:

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.

Thanks

Peer
