Class: Gitlab::EmojiNameValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
app/validators/gitlab/emoji_name_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



13
14
15
16
17
18
# File 'app/validators/gitlab/emoji_name_validator.rb', line 13

def validate_each(record, attribute, value)
  return if valid_tanuki_emoji?(value)
  return if valid_custom_emoji?(record, value)

  record.errors.add(attribute, (options[:message] || 'is not a valid emoji name'))
end