acook / config_module

Load important configuration files into their own modules
MIT License
2 stars 2 forks source link

Use a configuration block instead of defining "namespace" and "config_file" etc in the module itself #11

Open acook opened 11 years ago

acook commented 11 years ago

Right now namespace and config_file and soon config_env are defined on the module itself, while its only a handful of methods, it might be cleaner to do this in a configuration block:

module ExampleConfig
  extend ConfigModule
  config_module do
    file 'config/example.yml'
    env :example
    namespace config_module.env
  end
end

or maybe...

module ExampleConfig
  extend ConfigModule.setup do
    file 'config/example.yml'
    env :example
    namespace config_module.env
  end
end

This would also allow for lazy evaluation of methods that will be defined by the user on the module itself.