any_setting v0.1.0
Any Setting
Load your settings with ease.
- yaml files
- json files
- toml files
- ini files
Installation
Add this to your application's shard.yml
:
dependencies:
any_setting:
github: veelenga/any_setting
Usage
Settings file config/site.yml
:
default: &default
title: My Super Site
description: It just so cool and powerful.
made_by: John Doe
year: 2017
development:
<<: *default
url: http://localhost:3000
production:
<<: *default
url: https://example.com
Your loader:
require "any_setting"
class SiteSettings < AnySetting
source "config/site.yml"
namespace "production"
mapping(
title: String,
description: String,
url: String,
year: Int32,
author: {
type: String,
key: "made_by",
nillable: true,
}
)
end
site = SiteSettings.load
site.title #=> My Super Site
site.description #=> It just so cool and powerful.
site.made_by #=> John Doe
site.year #=> 2017
site.url #=> https://example.com
Contributing
- Fork it ( https://github.com/veelenga/any_setting/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Repository
any_setting
Owner
Statistic
- 0
- 0
- 0
- 0
- 0
- over 7 years ago
- July 18, 2017
License
MIT License
Links
Synced at
Sat, 23 Nov 2024 13:13:25 GMT
Languages