Class: AbideDevUtils::XCCDF::XccdfElement
- Inherits:
-
Object
- Object
- AbideDevUtils::XCCDF::XccdfElement
show all
- Includes:
- Common
- Defined in:
- lib/abide_dev_utils/xccdf.rb
Constant Summary
Constants included
from Common
Common::CIS_CONTROL_NUMBER, Common::CIS_CONTROL_PARTS, Common::CIS_LEVEL_CODE, Common::CIS_NEXT_GEN_WINDOWS, Common::CIS_PROFILE_PARTS, Common::CONTROL_PREFIX, Common::UNDERSCORED, Common::XPATHS
Instance Method Summary
collapse
Methods included from Common
#==, #abide_object?, #control_parts, #control_profile_text, #default_diff_opts, #diff, #name_normalize_control, #normalize_control_name, #normalize_profile_name, #normalize_string, #number_normalize_control, #profile_parts, #sorted_control_classes, #sorted_profile_classes, #text_normalize, #validate_xccdf, #xpath
Constructor Details
Returns a new instance of XccdfElement.
589
590
591
592
593
|
# File 'lib/abide_dev_utils/xccdf.rb', line 589
def initialize(element)
@xml = element
@element_type = self.class.name.split('::').last.downcase
@raw_title = control_profile_text(element)
end
|
Instance Method Details
#hiera_title(**opts) ⇒ Object
614
615
616
|
# File 'lib/abide_dev_utils/xccdf.rb', line 614
def hiera_title(**opts)
send("normalize_#{@element_type}_name".to_sym, @xml, **opts)
end
|
#reference ⇒ Object
610
611
612
|
# File 'lib/abide_dev_utils/xccdf.rb', line 610
def reference
@reference ||= @element_type == 'control' ? @xml['idref'] : @xml['id']
end
|
#to_h ⇒ Object
595
596
597
598
599
600
601
602
603
604
|
# File 'lib/abide_dev_utils/xccdf.rb', line 595
def to_h
@properties.each_with_object({}) do |pair, hash|
hash[pair[0]] = if pair[1].nil?
send(pair[0])
else
obj = send(pair[0])
obj.send(pair[1])
end
end
end
|
#to_s ⇒ Object
606
607
608
|
# File 'lib/abide_dev_utils/xccdf.rb', line 606
def to_s
@hash.inspect
end
|