Class: OpenscapParser::Fix

Inherits:
XmlNode
  • Object
show all
Includes:
Subs
Defined in:
lib/openscap_parser/fix.rb

Instance Attribute Summary

Attributes inherited from XmlNode

#namespaces

Instance Method Summary collapse

Methods included from Subs

included

Methods inherited from XmlNode

#initialize, #parsed_xml, #text, #xpath_node, #xpath_nodes

Constructor Details

This class inherits a constructor from OpenscapParser::XmlNode

Instance Method Details

#complexityObject



17
18
19
# File 'lib/openscap_parser/fix.rb', line 17

def complexity
  @complexity ||= @parsed_xml['complexity']
end

#disruptionObject



21
22
23
# File 'lib/openscap_parser/fix.rb', line 21

def disruption
  @disruption ||= @parsed_xml['disruption']
end

#full_text(set_values) ⇒ Object



29
30
31
# File 'lib/openscap_parser/fix.rb', line 29

def full_text(set_values)
  full_text_lines(set_values).join('')
end

#full_text_lines(set_values) ⇒ Object



33
34
35
36
37
# File 'lib/openscap_parser/fix.rb', line 33

def full_text_lines(set_values)
  map_child_nodes(set_values).map do |text_node|
    text_node.respond_to?(:text) ? text_node.text : ''
  end
end

#idObject



9
10
11
# File 'lib/openscap_parser/fix.rb', line 9

def id
  @id ||= @parsed_xml['id']
end

#map_child_nodes(set_values = []) ⇒ Object



39
40
41
# File 'lib/openscap_parser/fix.rb', line 39

def map_child_nodes(set_values = [])
  map_sub_nodes @parsed_xml.children, set_values
end

#strategyObject



25
26
27
# File 'lib/openscap_parser/fix.rb', line 25

def strategy
  @strategy ||= @parsed_xml['strategy']
end

#systemObject



13
14
15
# File 'lib/openscap_parser/fix.rb', line 13

def system
  @system ||= @parsed_xml['system']
end

#to_hObject



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/openscap_parser/fix.rb', line 43

def to_h
  {
    :id => id,
    :system => system,
    :complexity => complexity,
    :disruption => disruption,
    :strategy => strategy,
    :text => text,
    :subs => subs.map(&:to_h)
  }
end