Class: AbideDevUtils::Comply::NodeScanReport

Inherits:
Object
  • Object
show all
Defined in:
lib/abide_dev_utils/comply.rb

Overview

Class representation of a Comply node scan report

Constant Summary collapse

DIFF_PROPERTIES =
%i[passing failing error not_checked informational].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node_name, node_hash) ⇒ NodeScanReport

Returns a new instance of NodeScanReport.



465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/abide_dev_utils/comply.rb', line 465

def initialize(node_name, node_hash)
  @name = node_name
  @hash = node_hash
  @passing = node_hash.dig('scan_results', 'Pass') || {}
  @failing = node_hash.dig('scan_results', 'Fail') || {}
  @error = node_hash.dig('scan_results', 'Error') || {}
  @not_checked = node_hash.dig('scan_results', 'Not checked') || {}
  @informational = node_hash.dig('scan_results', 'Informational') || {}
  @benchmark = node_hash['benchmark']
  @last_scan = node_hash['last_scan']
  @profile = node_hash.fetch('custom_profile', nil) || node_hash.fetch('profile', nil)
  create_equality_methods
end

Instance Attribute Details

#benchmarkObject (readonly)

Returns the value of attribute benchmark.



461
462
463
# File 'lib/abide_dev_utils/comply.rb', line 461

def benchmark
  @benchmark
end

#errorObject (readonly)

Returns the value of attribute error.



461
462
463
# File 'lib/abide_dev_utils/comply.rb', line 461

def error
  @error
end

#failingObject (readonly)

Returns the value of attribute failing.



461
462
463
# File 'lib/abide_dev_utils/comply.rb', line 461

def failing
  @failing
end

#informationalObject (readonly)

Returns the value of attribute informational.



461
462
463
# File 'lib/abide_dev_utils/comply.rb', line 461

def informational
  @informational
end

#last_scanObject (readonly)

Returns the value of attribute last_scan.



461
462
463
# File 'lib/abide_dev_utils/comply.rb', line 461

def last_scan
  @last_scan
end

#nameObject (readonly)

Returns the value of attribute name.



461
462
463
# File 'lib/abide_dev_utils/comply.rb', line 461

def name
  @name
end

#not_checkedObject (readonly)

Returns the value of attribute not_checked.



461
462
463
# File 'lib/abide_dev_utils/comply.rb', line 461

def not_checked
  @not_checked
end

#passingObject (readonly)

Returns the value of attribute passing.



461
462
463
# File 'lib/abide_dev_utils/comply.rb', line 461

def passing
  @passing
end

#profileObject (readonly)

Returns the value of attribute profile.



461
462
463
# File 'lib/abide_dev_utils/comply.rb', line 461

def profile
  @profile
end

Instance Method Details

#diff(other) ⇒ Object



479
480
481
482
483
484
485
# File 'lib/abide_dev_utils/comply.rb', line 479

def diff(other)
  diff = {}
  DIFF_PROPERTIES.each do |prop|
    diff[prop] = send("#{prop}_equal?".to_sym, other.send(prop)) ? {} : property_diff(prop, other)
  end
  diff
end