Class: CMSScanner::Finders::Finder::SmartURLChecker::Findings

Inherits:
Array
  • Object
show all
Defined in:
lib/cms_scanner/finders/finder/smart_url_checker/findings.rb

Overview

Findings

Instance Method Summary collapse

Instance Method Details

#<<(finding) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cms_scanner/finders/finder/smart_url_checker/findings.rb', line 9

def <<(finding)
  return self unless finding

  each do |f|
    next unless f == finding && f.found_by == finding.found_by

    # This makes sure entries added are unique
    # and prevent pages redirecting to the same one to be added twice
    entries_to_add = finding.interesting_entries - f.interesting_entries
    return self if entries_to_add.empty?

    entries_to_add.each { |entry| f.interesting_entries << entry }

    f.confidence += finding.confidence

    return self
  end

  super(finding)
end