Project

figi

0.0
No commit activity in last 3 years
No release in over 3 years
Figi is a simple and easy ruby config library
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 10.0
~> 3.0

Runtime

~> 3.6
 Project Readme

FIGI Build Status Known Vulnerabilities

FIGI is a super simple configuration library you can use in your ruby application.

Installation

Add this line to your application's Gemfile:

gem 'figi'

And then execute:

$ bundle

Or install it yourself as:

$ gem install test

Usage

  • Support JSON and YAML file
require 'figi'

Figi::Config.from_json('config/config.json')
Figi::Config.from_yaml('config/config.yml')

puts figi.environment
# => development
  • Method access
require 'figi'

figi.host = 'localhost'
puts figi.host
# => localhost

puts figi.host?
# => true
 
puts figi.not_exists?
# => false 
  • Config once, use everywhere
require 'figi'

Figi::Config.load(environment: 'production', username: 'root')

puts figi.environment
# => production
puts figi.username
# => root
  • Config with DSL
Figi::Config.load do |config|
  config.environment = 'production'
  config.username = 'root'
end

puts figi.environment
# => production
  • Nested method access
# nested access
figi.db = {
  host: 'localhost',
  port: 27017
}
puts(figi.db.host) # => localhost
puts(figi.db.port) # => 27017

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/zt2/figi.

License

The gem is available as open source under the terms of the MIT License.