Sha256: 20e735b45622b53216eba234965e563fef4e1582057683736dd17a52a5b69aa4

Contents?: true

Size: 1.25 KB

Versions: 23

Compression:

Stored size: 1.25 KB

Contents

module CMSScanner
  module Finders
    # Finding
    module Finding
      # Fix for "Double/Dynamic Inclusion Problem"
      def self.included(base)
        base.include References
        super(base)
      end

      FINDING_OPTS = %i[confidence confirmed_by references found_by interesting_entries].freeze

      attr_accessor(*FINDING_OPTS)

      # @return [ Array ]
      def confirmed_by
        @confirmed_by ||= []
      end

      # Should be overriden in child classes
      # @return [ Array ]
      def interesting_entries
        @interesting_entries ||= []
      end

      # @return [ Integer ]
      def confidence
        @confidence ||= 0
      end

      # @param [ Integer ] value
      def confidence=(value)
        @confidence = value >= 100 ? 100 : value
      end

      # @param [ Hash ] opts
      def parse_finding_options(opts = {})
        FINDING_OPTS.each { |opt| send("#{opt}=", opts[opt]) if opts.key?(opt) }
      end

      # TODO: maybe also check for interesting_entries and confirmed_by ?
      # So far this is used in specs only
      def eql?(other)
        self == other && confidence == other.confidence && found_by == other.found_by
      end

      def <=>(other)
        to_s.downcase <=> other.to_s.downcase
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
cms_scanner-0.0.41.10 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.41.9 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.41.8 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.41.7 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.41.6 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.41.5 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.41.4 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.41.3 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.41.2 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.41.1 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.41.0 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.40.3 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.40.2 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.40.1 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.40 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.39.4 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.39.3 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.39.2 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.39.1 lib/cms_scanner/finders/finding.rb
cms_scanner-0.0.39.0 lib/cms_scanner/finders/finding.rb