Class: AbideDevUtils::XCCDF::Parser::Objects::ShortText

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

Overview

Holds text content that does not use multiple lines

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, parent_node: nil) ⇒ ShortText

Returns a new instance of ShortText.



243
244
245
246
247
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 243

def initialize(element, parent_node: nil)
  super
  text = element.respond_to?(:text) ? element.text : element
  @text = text.to_s
end

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



241
242
243
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 241

def text
  @text
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


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

def eql?(other)
  text == other.text
end

#hashObject



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

def hash
  text.hash
end

#to_sObject



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

def to_s
  @text
end