1
0
mirror of https://github.com/discourse/discourse.git synced 2025-03-09 14:34:35 +00:00
discourse/lib/validators/regex_presence_validator.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
302 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class RegexPresenceValidator
include RegexSettingValidation
def initialize(opts = {})
@opts = opts
initialize_regex_opts(opts)
end
def valid_value?(val)
val.present? && regex_match?(val)
end
def error_message
I18n.t(@regex_error)
end
end