Sha256: daf5a359481c03036fda5ef6ebbe3fbe3aeb04be996b07b3a0873195b5a67da9
Contents?: true
Size: 1.47 KB
Versions: 1
Compression:
Stored size: 1.47 KB
Contents
# Confix Adds well-defined configuration options to any class. This gem is similar to Mark Bates' Configuratron, except that it takes a well-defined configuration structure as a basis. By providing inline documentation, the settings can easily be documented, allowing for better to understand configuration. Confix adds support for loading configuration from a Hash (or YAML file), and provides templating to DRY up the configuration structure. ## Installation Add this line to your application's Gemfile: gem 'confix' And then execute: $ bundle Or install it yourself as: $ gem install confix ## Usage Include this module in a new object, like so: class MyConfiguration include Confix setting :database_url config :external_api do setting :enabled, false setting :client_id setting :client_secret end end Now, one can access these properties like this: cfg = MyConfiguration.new cfg.database_url = 'http://www.database.com' cfg.external_api.client_id = 'MyApp' or cfg.external_api.update :client_id => 'MyApp', :client_secret => '1234567890' Method `setting` allows you to define a single setting, and method `config` allows you to define a sub-configuration. ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
confix-1.0.0 | README.md |