module OpenStax::Utilities::Settings
Public Class Methods
load_settings(calling_file, relative_directory, filename)
click to toggle source
Reads and returns a hash of YAML settings from a file @param calling_file This should always be __FILE__ @param relative_directory This is a relative directory path that denotes the move from the directory containing calling_file, e.g. “..” will cause this method to look up one directory from the directory of calling_file @param filename the plain filename, e.g. 'foobar.yml'
# File lib/openstax/utilities/settings.rb, line 13 def self.load_settings(calling_file, relative_directory, filename) settings = {} filename = File.join(File.dirname(calling_file), relative_directory, filename) if File.file?(filename) settings = YAML::load_file(filename) settings.symbolize_keys! end settings end