Class: AbideDevUtils::XCCDF::Parser::Objects::ElementWithId
- Inherits:
-
ElementBase
- Object
- ElementBase
- AbideDevUtils::XCCDF::Parser::Objects::ElementWithId
- Defined in:
- lib/abide_dev_utils/xccdf/parser/objects.rb
Overview
Base class for elements that have the ID attribute
Constant Summary
Constants inherited from ElementBase
AbideDevUtils::XCCDF::Parser::Objects::ElementBase::UNICODE_SYMBOLS
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Attributes inherited from ElementBase
#child_labels, #children, #link_labels, #links, #parent
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(element, parent_node: nil) ⇒ ElementWithId
constructor
A new instance of ElementWithId.
- #to_s ⇒ Object
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, xpath
Methods included from Helpers::XPath
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) ⇒ ElementWithId
Returns a new instance of ElementWithId.
363 364 365 366 367 |
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 363 def initialize(element, parent_node: nil) super add_child(AttributeValue, element, 'id') @id = descendants.find { |d| d.label == 'id' }.value end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
361 362 363 |
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 361 def id @id end |
Instance Method Details
#<=>(other) ⇒ Object
369 370 371 372 373 |
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 369 def <=>(other) return nil unless other.instance_of?(self.class) @id <=> other.id.value end |
#eql?(other) ⇒ Boolean
375 376 377 |
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 375 def eql?(other) @id == other.id.value end |
#hash ⇒ Object
379 380 381 |
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 379 def hash @id.hash end |
#to_s ⇒ Object
383 384 385 |
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 383 def to_s @id end |