Sha256: 5a16d1915c75bcbf9d3df85481a18bd63eba0d0588efbc7ea281a31cf4ada721
Contents?: true
Size: 1.06 KB
Versions: 10
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module Mihari module Concerns # # False positive validatable concern # module FalsePositiveValidatable extend ActiveSupport::Concern prepend MemoWise # # 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 memo_wise :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
10 entries across 10 versions & 1 rubygems