https://github.com/dannyben/yamlcon
YAML Configuration File Loader
https://github.com/dannyben/yamlcon
gem ruby yaml yaml-configuration
Last synced: about 2 months ago
JSON representation
YAML Configuration File Loader
- Host: GitHub
- URL: https://github.com/dannyben/yamlcon
- Owner: DannyBen
- License: mit
- Created: 2016-03-08T22:03:24.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-01-29T08:21:05.000Z (over 2 years ago)
- Last Synced: 2025-03-05T01:15:47.154Z (over 1 year ago)
- Topics: gem, ruby, yaml, yaml-configuration
- Language: Ruby
- Size: 32.2 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
YAMLCon - YAML Config Loader
==================================================
A utility for loading and saving YAML files with dot.notation.
Install
--------------------------------------------------
Add to your gemfile
```ruby
gem 'yamlcon'
```
Usage
--------------------------------------------------
Load a single file
```ruby
config = YAML.load_config 'path/to/config.yml'
puts config.any_option.or_nested
```
You can then modify and save the file
```ruby
config.some_setting = 'value'
YAML.save_config 'filename.yml', config
```
Load multiple files by providing a glob pattern. In this case, each loaded
file will get its own prefix, using the basename of the file.
For example, given two files `config/one.yml` and `config/two.yml`, you can
do this:
```ruby
config = YAML.load_config 'config/*.yml'
puts config.one.option
puts config.two.option
```