0.0
No commit activity in last 3 years
No release in over 3 years
load the first existing YAML file
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.14
~> 10.0
 Project Readme

YAML-load_first

Installation

Add this line to your application's Gemfile:

# note that the case is important
gem 'YAML-load_first'

require like this (or use Bundle.require):

require 'yaml/load_first'

Usage

YAML-load_first works in the same way as YAML.load_file, but it takes an array of files, and will load the first one that exists. This can be used to load config files, looking at a number of locations until a matching one is found.

Example

require 'yaml/load_first'

# the first matching file will be loaded as the config
CONFIG = YAML.load_first_file [
    "#{ENV['HOME']}/config/app.config", 
    "./config/prod.config", 
    "./config/dev.config"
]

License

The gem is available as open source under the terms of the MIT License.