Class: CMSScanner::Finders::Findings

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

Overview

Findings container

Instance Method Summary collapse

Instance Method Details

#+(other) ⇒ Object

Append the elements of other into self AND returns self This is not the default behaviour of Array#+ but it’s intended



20
21
22
# File 'lib/cms_scanner/finders/findings.rb', line 20

def +(other)
  other.each { |f| self << f }
end

#<<(other) ⇒ Object

Override to include the confirmed_by logic



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/cms_scanner/finders/findings.rb', line 6

def <<(other)
  each do |found|
    next unless found == other

    found.confirmed_by << other
    # TODO: Increase confidence (e.g: (found + other) / 1.5 ?)
    return self
  end

  super(other)
end