Class: ActiveModel::Validations::HexColorValidator
- Inherits:
-
EachValidator
- Object
- EachValidator
- ActiveModel::Validations::HexColorValidator
- Defined in:
- lib/active_validators/active_model/validations/hex_color_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
4 5 6 7 8 |
# File 'lib/active_validators/active_model/validations/hex_color_validator.rb', line 4 def validate_each(record, attribute, value) unless value =~ /\A(\h{3}){,2}\z/ record.errors.add(attribute) end end |