Installation

gem install simple_confign

or 

gem 'simple_config'

in Gemfile

Description

Allows dot notation to access properties that are defined in YML file

Usage

Default configuration file example: 

geometry:
  type: square
  background_color: red
  position:
    top-left: 
      - 0
      - 0
    right-bottom:
      - 100
      - 100

SimpleConfig.type               # "square"
SimpleConfig.position           # OpenStruct
SimpleConfig.position.top-left  # [0, 0]

Also it's possible to use file name as a first parameter: 

SimpleConfig.config_file1.property #config_file1 will be loaded
SimpleConfig.config_file2.property #config_file2 will be loaded

Default config file will be used if specific one not found.

Options

Example of initializers/simple_config.rb:

SimpleConfig.default = :default_file #set default configuration file name to  default_file.yml. Default value :config
SimpleConfig.directory = :default_directory #set default configuration directory to default_directory. Default value :config

Contributing to simple_config

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2010 Valeriy Prokopchuk. See LICENSE.txt for further details.