class Chef::Resource::InspecWaiverFileEntry

Public Instance Methods

load_waiver_file_to_hash(file_name) click to toggle source
# File lib/chef/resource/inspec_waiver_file_entry.rb, line 137
def load_waiver_file_to_hash(file_name)
  if file_name =~ %r{(/|C:\\).*(.yaml|.yml)}i
    if ::File.exist?(file_name)
      hash = ::YAML.load_file(file_name)
      if hash == false || hash.nil? || hash == ""
        {}
      else
        ::YAML.load_file(file_name)
      end
    else
      {}
    end
  else
    raise "Waiver files needs to be a YAML file which should have a .yaml or .yml extension -\"#{file_name}\" does not have an appropriate extension"
  end
end