Module: Pkg::Util::Serialization

Defined in:
lib/packaging/util/serialization.rb

Overview

Utility methods for dealing with serialization of Config params

Class Method Summary collapse

Class Method Details

.load_yaml(file) ⇒ Object

Given the path to a yaml file, load the yaml file into an object and return the object.



6
7
8
9
10
11
12
13
14
15
# File 'lib/packaging/util/serialization.rb', line 6

def load_yaml(file)
  require 'yaml'
  file = File.expand_path(file)
  begin
    input_data = YAML.load_file(file) || {}
  rescue StandardError => e
    fail "There was an error loading data from #{file}.\n#{e}"
  end
  input_data
end