Sha256: af8f36c2005f9959ab2e82d8f0f57ef15defea2fc3073cbc9a6b0f35a171eaf7
Contents?: true
Size: 986 Bytes
Versions: 15
Compression:
Stored size: 986 Bytes
Contents
# frozen_string_literal: true module Mihari module Mixins module FalsePositive include Memist::Memoizable # # Normalize a falsepositive value # # @param [String] value # # @return [String, Regexp] # def normalize_falsepositive(value) return value if !value.start_with?("/") || !value.end_with?("/") # if a value is surrounded by slashes, take it as a regexp value_without_slashes = value[1..-2] Regexp.compile value_without_slashes.to_s end memoize :normalize_falsepositive # # Check whether a value is valid format as a disallowed data value # # @param [String] value Data value # # @return [Boolean] true if it is valid, otherwise false # def valid_falsepositive?(value) begin normalize_falsepositive value rescue RegexpError return false end true end end end end
Version data entries
15 entries across 15 versions & 1 rubygems