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

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