0.01
No commit activity in last 3 years
No release in over 3 years
constantizer is a gem for bulding constants in the app using YAML files
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.6
>= 0
>= 0
>= 3.0
 Project Readme

Gem Version Code Climate Test Coverage

Constantizer

Constantizer helps you manage your ruby constants to be used through out your application.

Features

  • Constants are added using YAML files.

Installation

Add this line to your application's Gemfile:

gem 'constantizer'

And then execute:

$ bundle

And then execute:

$ bundle exec constantizer install

Constants directory will be created:

└── config
    └── constants
        └── common.yml

Configurations

You can configure the gem to use a specific directory other than the default. To achive that, in constantizer.rb file add the following:

Constantizer.configure do |config|
  config.directory = 'special_directory'
end

now put the YAML files contaning the constants under that special_directory

Usage

Constantizer allow you to create constants that are accessible from everywhere in your app.

Given the following YAML file

currencies:
  - USD
  - EUR
default_currency: USD

You can go to anywhere in your app and do the following:

CURRENCIES.include?('USD')     #=> true

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 a new Pull Request