Class: AbideDevUtils::XCCDF::Parser::Objects::AttributeValue

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

Overview

Represents a value of an element attribute

Constant Summary

Constants inherited from ElementBase

ElementBase::UNICODE_SYMBOLS

Instance Attribute Summary collapse

Attributes inherited from ElementBase

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

Instance Method Summary collapse

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

#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, attribute, parent_node: nil) ⇒ AttributeValue

Returns a new instance of AttributeValue.



291
292
293
294
295
296
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 291

def initialize(element, attribute, parent_node: nil)
  super
  @attribute = attribute
  @value = element[attribute]
  similarity_methods :attribute, :value
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



289
290
291
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 289

def attribute
  @attribute
end

#valueObject (readonly)

Returns the value of attribute value.



289
290
291
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 289

def value
  @value
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


298
299
300
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 298

def eql?(other)
  @attribute == other.attribute && @value == other.value
end

#hashObject



302
303
304
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 302

def hash
  to_s.hash
end

#to_sObject



306
307
308
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 306

def to_s
  "#{@attribute}=#{@value}"
end