Class: AbideDevUtils::XCCDF::Parser::Objects::Profile

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

Overview

Class for XCCDF profile

Constant Summary

Constants inherited from ElementBase

ElementBase::UNICODE_SYMBOLS

Instance Attribute Summary

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 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) ⇒ Profile

Returns a new instance of Profile.



436
437
438
439
440
441
442
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 436

def initialize(element, parent_node: nil)
  super
  add_child(Title, element)
  add_child(Description, element)
  add_children(XccdfSelect, element)
  similarity_methods :id, :title, :level, :description, :xccdf_select
end

Class Method Details

.xpathObject



452
453
454
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 452

def self.xpath
  'Profile'
end

Instance Method Details

#levelObject



444
445
446
447
448
449
450
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 444

def level
  return @level if defined?(@level)

  level_match = title.to_s.match(/([Ll]evel [0-9]+)/)
  @level = level_match.nil? ? level_match : level_match[1]
  @level
end