Class: AbideDevUtils::XCCDF::Parser::Objects::LongText
- Inherits:
-
ElementBase
- Object
- ElementBase
- AbideDevUtils::XCCDF::Parser::Objects::LongText
- Defined in:
- lib/abide_dev_utils/xccdf/parser/objects.rb
Overview
Holds text content that consists of multiple lines
Constant Summary
Constants inherited from ElementBase
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Attributes inherited from ElementBase
#child_labels, #children, #link_labels, #links, #parent
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(element, parent_node: nil) ⇒ LongText
constructor
A new instance of LongText.
- #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) ⇒ LongText
Returns a new instance of LongText.
266 267 268 269 270 271 272 |
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 266 def initialize(element, parent_node: nil) super text = element.respond_to?(:text) ? element.text : element @text = text.to_s @string_text = text.to_s.tr("\n", ' ').gsub(/\s+/, ' ') similarity_methods :to_s end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
264 265 266 |
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 264 def text @text end |
Instance Method Details
#eql?(other) ⇒ Boolean
274 275 276 |
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 274 def eql?(other) @string_text == other.to_s end |
#hash ⇒ Object
278 279 280 |
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 278 def hash @string_text.hash end |
#to_s ⇒ Object
282 283 284 |
# File 'lib/abide_dev_utils/xccdf/parser/objects.rb', line 282 def to_s @string_text end |