Module: AbideDevUtils::Sce::Mapping::MixinCIS

Defined in:
lib/abide_dev_utils/sce/mapping/mapper.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

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



251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/abide_dev_utils/sce/mapping/mapper.rb', line 251

def get_map(control_id, level: nil, profile: nil, **_)
  identified_map_data(control_id, valid_types: CIS_TYPES).get(control_id, level: level, profile: profile)
  return unless imdata

  if level.nil? || profile.nil?
    map_data[mtype][mtop].each do |lvl, profile_hash|
      next if lvl == 'benchmark' || (level && level != lvl)

      profile_hash.each do |prof, control_hash|
        next if profile && profile != prof

        return control_hash[control_id] if control_hash.key?(control_id)
      end
    end
  else
    imdata[level][profile][control_id]
  end
end