module AuthenticationStrategies::Helpers::YamlHelper

Set of helpers for working with YAML

Public Class Methods

read_yaml(path) click to toggle source

Helps with reading YAML files with ERB snippets

# File lib/authentication_strategies/helpers/yaml_helper.rb, line 5
def self.read_yaml(path)
  begin
    raise "File does not exist!" unless File.exists?(path)
    YAML.load(ERB.new(File.read(path)).result)
  rescue Exception => err
    raise ::Errors::ConfigurationParsingError,
          "Failed to parse a YAML file! [#{path}]: #{err.message}"
  end
end