Sha256: 88d2673c8c5dce83316b5da9c67754edc312caaafa88e37e7ffbbe8f7d9f932b
Contents?: true
Size: 275 Bytes
Versions: 11
Compression:
Stored size: 275 Bytes
Contents
class HexValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) unless value =~ /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/ record.errors[attribute] << (options[:message] || I18n.t('flash_validators.errors.messages.hex')) end end end
Version data entries
11 entries across 11 versions & 1 rubygems