Class: Inspec::Resources::XmlConfig

Inherits:
JsonConfig show all
Defined in:
lib/resources/xml.rb

Instance Attribute Summary

Attributes inherited from JsonConfig

#params

Instance Method Summary collapse

Methods inherited from JsonConfig

#initialize, #method_missing

Methods included from ObjectTraverser

#extract_value

Constructor Details

This class inherits a constructor from Inspec::Resources::JsonConfig

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Inspec::Resources::JsonConfig

Instance Method Details

#parse(content) ⇒ Object



14
15
16
17
# File 'lib/resources/xml.rb', line 14

def parse(content)
  require 'rexml/document'
  REXML::Document.new(content)
end

#to_sObject



23
24
25
# File 'lib/resources/xml.rb', line 23

def to_s
  "XML #{@path}"
end

#value(key) ⇒ Object



19
20
21
# File 'lib/resources/xml.rb', line 19

def value(key)
  REXML::XPath.each(@params, key.first.to_s).map(&:text)
end