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