mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 18:23:39 +08:00
17 lines
271 B
Ruby
17 lines
271 B
Ruby
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
|