356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
|
# File 'lib/utilities/parser.rb', line 356
def add_cis
@transformed_data&.map do |ctrl|
if !ctrl[:cis] && ctrl[:ref]
references = ctrl[:ref].split("\n")
references.each do |ref|
match = ref.scan(/(?<=#)\d+\.\d+/).map(&:inspect).join(',').delete('"').tr(',', ' ')
ctrl[:cis] = match.split(' ') unless match.empty?
end
ctrl[:cis] = 'No CIS Control' unless ctrl[:cis]
elsif !ctrl[:cis] && !ctrl[:ref]
ctrl[:cis] = 'No CIS Control'
elsif ctrl[:cis] && ctrl[:ref]
ctrl[:cis] = ctrl[:cis].scan(/^\d+[\.\d+]*/)
end
end
end
|