Module: AuthenticationStrategies::Helpers::YamlHelper

Defined in:
lib/authentication_strategies/helpers/yaml_helper.rb

Overview

Set of helpers for working with YAML

Class Method Summary collapse

Class Method Details

.read_yaml(path) ⇒ Object

Helps with reading YAML files with ERB snippets


5
6
7
8
9
10
11
12
13
# 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