Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cfcosta/config_man
Simplifies repetitive work of parsing configuration files
https://github.com/cfcosta/config_man
Last synced: 25 days ago
JSON representation
Simplifies repetitive work of parsing configuration files
- Host: GitHub
- URL: https://github.com/cfcosta/config_man
- Owner: cfcosta
- Created: 2012-02-14T03:10:44.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2012-02-14T03:11:12.000Z (almost 13 years ago)
- Last Synced: 2024-10-09T17:55:00.575Z (about 1 month ago)
- Language: Ruby
- Homepage:
- Size: 85.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ConfigMan
ConfigMan is a simple library, without external dependencies, to load config files and expose an interface on top of them.
## How to Use
Let's say for example we have this yaml config file:
```yaml
foo:
bar:
baz: qux
barbar: [1,2,3]
bazbaz:
foofoo:
barbar: qux
```We can load it like this:
```ruby
config = ConfigMan::Loader.new('config/config.yml')
config.foo.bar.baz # "qux"
config.foo.barbar # [1,2,3]
config.foo.bazbaz.foofoo.barbar # "qux"
```Instead of acessing it directly, we can also export as a hash:
```ruby
config.foo.to_hash # {bar: {baz: "qux"}, barbar: [1,2,3], ...}
```