Project

ascetic

0.0
No commit activity in last 3 years
No release in over 3 years
Basic configuration loader
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 4.3
~> 0.9
~> 0.8
 Project Readme

Ascetic

Ascetic is a basic tool to interact with JSON or YAML configuration files.

Installation

Place this in your Gemfile:

gem 'ascetic'

Then bundle install.

Usage

require 'ascetic'

# Yaml files:
Ascetic.load! '/path/to/config.yml'

# Json files:
Ascetic.load! '/path/to/config.json'

Ascetic will marshal the files and expose the options as methods. For example, if your config.json looks like this:

{
  "api_key": "ec_fn_11h5bseljre35x"
}

You will have the api_key method and a special api_key? presence check method available on your Ascetic object, like so:

Ascetic.api_key?
# => true

Ascetic.api_key
# => "ec_fn_11h5bseljre35x"

Any value set to false, or value which is not present in your configuration file, will result in false when a presence check is run.

Ascetic.option_not_present_in_config?
# => false

Ascetic.option_not_present_in_config
# => nil

Ascetic.option_set_to_false_in_config?
# => false

Ascetic.option_set_to_false_in_config
# => false