Sha256: 6fb3e543b881e2a5971b03f656cd3c9541a80edf77b22c2592697c7631ca5cbc

Contents?: true

Size: 613 Bytes

Versions: 4

Compression:

Stored size: 613 Bytes

Contents

module CMSScanner
  module Finders
    # Findings container
    class Findings < Array
      # Override to include the confirmed_by logic
      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

      # Append the elements of other into self AND returns self
      # This is not the default behaviour of Array#+ but it's intended
      def +(other)
        other.each { |f| self << f }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cms_scanner-0.0.5 lib/cms_scanner/finders/findings.rb
cms_scanner-0.0.4 lib/cms_scanner/finders/findings.rb
cms_scanner-0.0.3 lib/cms_scanner/finders/findings.rb
cms_scanner-0.0.2 lib/cms_scanner/finders/findings.rb