Module: AbideDevUtils::CEM::Mapping::MixinCIS

Defined in:
lib/abide_dev_utils/cem/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



246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/abide_dev_utils/cem/mapping/mapper.rb', line 246

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