Method: Secrets::YAML#initialize

Defined in:
lib/inspec/secrets/yaml.rb

#initialize(target) ⇒ YAML

array of yaml file paths



19
20
21
22
23
24
25
26
27
28
# File 'lib/inspec/secrets/yaml.rb', line 19

def initialize(target)
  @attributes = ::YAML.load_file(target)

  if @attributes == false || !@attributes.is_a?(Hash)
    Inspec::Log.warn("#{self.class} unable to parse #{target}: invalid YAML or contents is not a Hash")
    @attributes = nil
  end
rescue => e
  raise "Error reading InSpec attributes: #{e}"
end