Class: AbideDevUtils::XCCDF::Parser::Objects::Benchmark

Inherits:
ElementBase
  • Object
show all
Includes:
NumberedObject
Defined in:
lib/abide_dev_utils/xccdf/parser/objects.rb

Overview

Class for XCCDF benchmark

Instance Attribute Summary

Attributes inherited from ElementBase

#child_labels, #children, #link_labels

Class Method Summary collapse

Instance Method Summary collapse

Methods included from NumberedObject

#<=>, #find_child_by_number, #number_child_of?, #number_eq, #number_gt, #number_lt, #number_parent_of?, #search_children_by_number

Methods inherited from ElementBase

#add_link, #add_links, #all_values, #label, #method_missing, #respond_to_missing?, #xccdf_type, xmlns

Methods included from Helpers::XPath

#find_element

Methods included from Helpers::ElementChildren

#search_children

Methods included from DigestObject

#digest, #digest_equal?, #digest_similarity, #digestable_instance_variables, #exclude_from_digest, #labeled_self_digest, #non_compatible?, #normalize_exclusion, #sorted_digest_parts, #split_labeled_digest

Constructor Details

#initialize(element) ⇒ Benchmark

Returns a new instance of Benchmark.



658
659
660
661
662
663
664
665
666
667
668
669
670
671
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 658

def initialize(element)
  super
  elem = find_element.at_xpath(element, 'Benchmark')
  raise 'No Benchmark element found' if elem.nil?

  add_child(Status, elem)
  add_child(Title, elem)
  add_child(Description, elem)
  add_child(Platform, elem)
  add_child(Version, elem)
  add_children(Profile, elem)
  add_children(Group, elem)
  add_children(Value, elem)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class AbideDevUtils::XCCDF::Parser::Objects::ElementBase

Class Method Details

.xpathObject



673
674
675
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 673

def self.xpath
  'Benchmark'
end

Instance Method Details

#to_sObject



677
678
679
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 677

def to_s
  [search_children.find_child_by_class(Title).to_s, search_children.find_child_by_class(Version).to_s].join(' ')
end