Class: AbideDevUtils::XCCDF::Parser::Objects::Rule

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

Overview

Class for XCCDF rule

Constant Summary

Constants inherited from ElementBase

ElementBase::UNICODE_SYMBOLS

Instance Attribute Summary collapse

Attributes inherited from ElementWithId

#id

Attributes inherited from ElementBase

#child_labels, #children, #link_labels, #links, #parent

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 ElementWithId

#<=>, #eql?, #hash, #to_s

Methods inherited from ElementBase

#<=>, #add_link, #add_links, #all_values, #ancestors, #depth, #descendants, #find_similarity, #inspect, #label, #leaf?, #print_tree, #root, #root?, #siblings, #xccdf_type, xmlns

Methods included from Helpers::XPath

#find_element

Methods included from DiffableObject

#check_diffable!, #correlate_added_removed, #diff, #diff_ambiguous, #diff_array_obj, #diff_benchmark, #diff_change_result, #diff_check, #diff_complex_check, #diff_group, #diff_plain_obj, #diff_profile, #diff_rule, #diff_str_obj, #diff_value, #diff_xccdf_select, #process_details_hash!, #result_from_details_hash

Constructor Details

#initialize(element, parent_node: nil) ⇒ Rule

Returns a new instance of Rule.



808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 808

def initialize(element, parent_node: nil)
  super
  @number = to_s[/([0-9]+\.)+[0-9]+/]
  add_child(AttributeValue, element, 'role')
  add_child(AttributeValue, element, 'selected')
  add_child(AttributeValue, element, 'weight')
  add_child(Title, element)
  add_child(Description, element)
  add_child(Rationale, element)
  add_children(Ident, element)
  add_child(Fixtext, element)
  add_children(Check, element)
  add_child(ComplexCheck, element)
  add_child(Metadata, element)
  similarity_methods :number, :title
end

Instance Attribute Details

#numberObject (readonly)

Returns the value of attribute number.



806
807
808
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 806

def number
  @number
end

Class Method Details

.xpathObject



825
826
827
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 825

def self.xpath
  'Rule'
end