Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 1.81 KB

README.md

File metadata and controls

48 lines (34 loc) · 1.81 KB

Kori

Gem Version Build Status Code Climate Test Coverage Dependency Status

Kori generate deep frozen objects from yaml or hash. It using a ice_nine, inspired by Settingslogic.

Kori(kōri) means Ice in japanese.

Installation

$ gem install kori

Usage

require 'kori'

# From Hash
config = Kori.freeze({ a: 1, b: { c: 'abc' } })
config.a                # 1
config[:a]              # 1
config['a']             # 1
config.b                # { c: 'abc' }
config.b.class          # Kori
config.b.c              # 'abc'
config.forzen?          # true
config.a.frozen?        # true
config.b.frozen?        # true
config.b.c.frozen?      # true

# From YAML
config = Kori.freeze('app_config.yml')          # load from ./app_config.yml
config = Kori.freeze('/path/to/app_config.yml') # load from /path/to/app_config.yml

# If you are using Rails, it is possible to use as `Rails.application.config_for`
config = Kori.freeze(:app_config)               # load from /rails_root/config/app_config.yml
config = Kori.freeze('subdir/app_config')       # load from /rails_root/config/subdir/app_config.yml

License

MIT License

see LICENSE.txt.