class Secrets::YAML

Attributes

inputs[R]

Public Class Methods

new(target) click to toggle source

array of yaml file paths

# File lib/inspec/secrets/yaml.rb, line 18
def initialize(target)
  @inputs = ::YAML.load_file(target)

  if @inputs == false || !@inputs.is_a?(Hash)
    Inspec::Log.warn("#{self.class} unable to parse #{target}: invalid YAML or contents is not a Hash")
    @inputs = nil
  end
rescue => e
  raise "Error reading InSpec inputs: #{e}"
end
resolve(target) click to toggle source
# File lib/inspec/secrets/yaml.rb, line 9
def self.resolve(target)
  unless target.is_a?(String) && File.file?(target) && [".yml", ".yaml"].include?(File.extname(target).downcase)
    return nil
  end

  new(target)
end