Git Product home page Git Product logo

rubygem_config-parser's Introduction

Config parser gem

Parsing an options.yml file into a Hash with convenience methods like overwriting variables per Rails environment and overwriting variables with a local options_local.yml file.

Installation

The best way to install is with RubyGems:

$ [sudo] gem install config-parser

Or better still, just add it to your Gemfile:

gem 'config-parser'

Defaults

Per default the parser will search for the config file at config/options.yml and config/options-local.yml.

Example

Example config file:

default:
  supported_languages: en
  mailer_delivery_method: local

production:
  mailer_delivery_method: smtp

When running in the production environment, the mailer_delivery_method will be set to 'smtp'. The same works for all other environments. The optional options_local.yml file would have the same layout. When used from a Rails app, just include in your application.rb:

OPTS = Common::Options.new

and you can use the config variables like:

OPTS.<variable_name>

Also, you can pass main config and local config location as well as environment to load That allows you to use config-parser outside Rails env.

OPTS = Common::Options.new('path/to/options.yml', 'path/to/options-local.yml', :development)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.