Class: Secrets::YAML

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/secrets/yaml.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(target) ⇒ YAML

array of yaml file paths



19
20
21
22
23
# File 'lib/inspec/secrets/yaml.rb', line 19

def initialize(target)
  @attributes = ::YAML.load_file(target)
rescue => e
  raise "Error reading Inspec attributes: #{e}"
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



9
10
11
# File 'lib/inspec/secrets/yaml.rb', line 9

def attributes
  @attributes
end

Class Method Details

.resolve(target) ⇒ Object



11
12
13
14
15
16
# File 'lib/inspec/secrets/yaml.rb', line 11

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