Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/ figi Public

A super simple configuration library in Ruby

License

Notifications You must be signed in to change notification settings

zt2/figi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

22 Commits

Repository files navigation

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.

About

A super simple configuration library in Ruby

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

AltStyle によって変換されたページ (->オリジナル) /