No commit activity in last 3 years
No release in over 3 years
This gem is to provide a simple way of storing information in one place and get this information anywhere in a Rails application.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
 Project Readme

Informante Build Status

Simple rails gem for configurations of global inforamations

This gem is to provide a simple way of storing information in one place and get this information anywhere in a Rails application.

Installation

Add this line to your application's Gemfile:

gem 'informante'

And then execute:

bundle install

Finishing, use the generator provided by Informante:

rails g informante:install

This command is responsible for generating two files for our application:

  • informante.yml - file with yaml markup to store information for our application
  • informante.rb - contains global method called informante for our application

Usage

By default, our informante.yml file has the following configuration:

# -- basic example for informante.yml --
#
system:
  name          : 'Name System'
  title         : 'Title System'
  description   : 'Description System'
  company       : '© Company System'
  business      : 'Business System'
  developers    : [
    {
      name  : 'name',
      email : 'email',
      site  : 'site'
    },
  ]

you can store the configuration file that you want, simply follow the standard format for yaml and save the file informante.yml

At every point of our application, just use the global method informante. See an example on the console:

$ informante[:system][:name]
>> "Name System"

By default our informante method returns a hash with symbol key. This method responds to four types of format:

- informante(:hash) # informante(:hash) == informant
- informante(:object)
- informante(:array)
- informante(:string)

Example for respond to object:

$ informante(:object).system.description
>> "Description System"

Example for respond to string:

$ informante(:string)
>> "{:system=>{:name=>\"Name System\", :title=>\"Title System\", :description=>\"Description System\", :company=>\"© Company System\", :business=>\"Business System\", :developers=>[{:name=>\"name\", :email=>\"email\", :site=>\"site\"}]}}"

Notes

You can use the informante method directly:

  • controllers
  • views
  • models
  • helpers

Important, every time you modify the informante.yml file you must restart the rails server.

Version

0.0.1