Class: AbideDevUtils::XCCDF::Parser::Objects::ElementWithId

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

Overview

Base class for elements that have the ID attribute

Direct Known Subclasses

Group, Profile, Rule, Value

Instance Attribute Summary collapse

Attributes inherited from ElementBase

#child_labels, #children, #link_labels

Instance Method Summary collapse

Methods inherited from ElementBase

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

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

Returns a new instance of ElementWithId.



251
252
253
254
255
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 251

def initialize(element)
  super
  add_child(AttributeValue, element, 'id')
  @id = search_children.find_child_by_attribute('id').value.to_s
end

Dynamic Method Handling

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

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



249
250
251
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 249

def id
  @id
end

Instance Method Details

#to_sObject



257
258
259
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 257

def to_s
  @id
end