lib/pdk/module/template_dir/base.rb
# Generates a hash of data from a given yaml file location.
#
# @param loc [String] The path of the yaml config file.
#
# @warn If the specified path is not a valid yaml file. Returns an empty Hash
# if so.
#
# @return [Hash] The data that has been read in from the given yaml file.
#
# @api private
Generates a hash of data from a given yaml file location.
Generates a hash of data from a given yaml file location .
def read_config(loc)
          if PDK::Util::Filesystem.file?(loc) && PDK::Util::Filesystem.readable?(loc)
            require 'yaml'
            begin
              YAML.safe_load(PDK::Util::Filesystem.read_file(loc), [], [], true)
            rescue Psych::SyntaxError => e
              PDK.logger.warn _("'%{file}' is not a valid YAML file: %{problem} %{context} at line %{line} column %{column}") % {
                file:    loc,
                problem: e.problem,
                context: e.context,
                line:    e.line,
                column:  e.column,
              }
              {}
            end
          else
            {}
          end
        end
def read_config ( loc ) if PDK :: Util :: Filesystem . file? ( loc ) && PDK :: Util :: Filesystem . readable? ( loc ) require 'yaml' begin YAML . safe_load ( PDK :: Util :: Filesystem . read_file ( loc ) , [ ] , [ ] , true ) rescue Psych :: SyntaxError => e PDK . logger . warn _ ( "'%{file}' is not a valid YAML file: %{problem} %{context} at line %{line} column %{column}" ) % { file : loc , problem : e . problem , context : e . context , line : e . line , column : e . column , } { } end else { } end end
Generates a hash of data from a given yaml file location.
Generates a hash of data from a given yaml file location .
The data that has been read in from the given yaml file.
The data that has been read in from the given yaml file .
Hash
loc
The path of the yaml config file.
The path of the yaml config file .
warn
If the specified path is not a valid yaml file. Returns an empty Hash if so.
If the specified path is not a valid yaml file . Returns an empty Hash if so .
api
None