Skip to content

A ruby gem that helps you manage your ruby constants to be used through out your application.

License

Notifications You must be signed in to change notification settings

baraabourghli/constantizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A ruby gem that helps you manage your ruby constants to be used through out your application.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages