Module: AbideDevUtils::CEM::HieraData::MappingData::MixinSTIG

Defined in:
lib/abide_dev_utils/cem/hiera_data/mapping_data/mixins.rb

Overview

Mixin module used by Mapper to implement STIG-specific mapping behavior

Instance Method Summary collapse

Instance Method Details

#get_map(control_id, level: nil, **_) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/abide_dev_utils/cem/hiera_data/mapping_data/mixins.rb', line 31

def get_map(control_id, level: nil, **_)
  mtype, mtop = map_type_and_top_key(control_id)
  return unless STIG_TYPES.include?(mtype)
  return map_data[mtype][mtop][level][control_id] unless level.nil?

  map_data[mtype][mtop].each do |lvl, control_hash|
    next if lvl == 'benchmark'

    return control_hash[control_id] if control_hash.key?(control_id)
  end
end