Module: Versed::Reader

Defined in:
lib/versed/reader.rb

Class Method Summary collapse

Class Method Details

.read(path) ⇒ Hash

Reads YAML from a file

Parameters:

  • path (String)

    The path to the file

Returns:

  • (Hash)

    The parsed YAML file



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/versed/reader.rb', line 9

def self.read(path)
  begin
    return YAML.load(IO.read(path))
  rescue YAML::Error => e
    puts "Encountered an error reading YAML from #{path}"
    puts e.message
    exit 1
  rescue StandardError => e
    puts e.message
    exit 1
  end
end