Class: AbideDevUtils::XCCDF::Diff::PropertyExistenceChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/abide_dev_utils/xccdf/diff/benchmark/property_existence.rb

Overview

PropertyExistenceChecker provides methods to check existence state of various properties

Direct Known Subclasses

PropChecker

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*_args) ⇒ PropertyExistenceChecker

Returns a new instance of PropertyExistenceChecker.



8
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/property_existence.rb', line 8

def initialize(*_args); end

Class Method Details

.inverse_existence_stateObject

Returns a hash of existence states and their inverse.



25
26
27
28
29
30
31
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/property_existence.rb', line 25

def self.inverse_existence_state
  {
    removed: :added,
    added: :removed,
    exists: :exists,
  }
end

Instance Method Details

#added(self_props, other_props) ⇒ Object

Compares two arrays (or other iterables implementing `#to_a`) containing properies and returns an array of the properties that are added by other_props but not in self_props.



13
14
15
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/property_existence.rb', line 13

def added(self_props, other_props)
  other_props.to_a - self_props.to_a
end

#removed(this, other) ⇒ Object

Compares two arrays (or other iterables implementing `#to_a`) containing properies and returns an array of the properties that are removed by other_props but exist in self_props.



20
21
22
# File 'lib/abide_dev_utils/xccdf/diff/benchmark/property_existence.rb', line 20

def removed(this, other)
  this.to_a - other.to_a
end